Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/public-domain/sqlite/dist When aggregate-allocating...



details:   https://anonhg.NetBSD.org/src/rev/0f6b3de77f48
branches:  trunk
changeset: 772579:0f6b3de77f48
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jan 09 11:20:20 2012 +0000

description:
When aggregate-allocating an index structure make sure to provide at least
natural alignement for pointers.
This makes firefox 3.6 work again on sparc64.

diffstat:

 external/public-domain/sqlite/dist/sqlite3.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r ee4856450f7e -r 0f6b3de77f48 external/public-domain/sqlite/dist/sqlite3.c
--- a/external/public-domain/sqlite/dist/sqlite3.c      Mon Jan 09 10:57:34 2012 +0000
+++ b/external/public-domain/sqlite/dist/sqlite3.c      Mon Jan 09 11:20:20 2012 +0000
@@ -81883,7 +81883,8 @@
   Token *pName = 0;    /* Unqualified name of the index to create */
   struct ExprList_item *pListItem; /* For looping over pList */
   int nCol;
-  int nExtra = 0;
+  int nExtra = 0, nPad = 0;
+  size_t nOff;
   char *zExtra;
 
   assert( pStart==0 || pEnd!=0 ); /* pEnd must be non-NULL if pStart is */
@@ -82053,6 +82054,8 @@
   */
   nName = sqlite3Strlen30(zName);
   nCol = pList->nExpr;
+  nOff = sizeof(*pIndex)+sizeof(tRowcnt)*(nCol+1);
+  nPad = ((nOff + (sizeof(char*)-1)) & ~ (sizeof(char*)-1)) - nOff;
   pIndex = sqlite3DbMallocZero(db, 
       sizeof(Index) +              /* Index structure  */
       sizeof(tRowcnt)*(nCol+1) +   /* Index.aiRowEst   */
@@ -82060,13 +82063,14 @@
       sizeof(char *)*nCol +        /* Index.azColl     */
       sizeof(u8)*nCol +            /* Index.aSortOrder */
       nName + 1 +                  /* Index.zName      */
-      nExtra                       /* Collation sequence names */
+      nExtra +                     /* Collation sequence names */
+      nPad
   );
   if( db->mallocFailed ){
     goto exit_create_index;
   }
   pIndex->aiRowEst = (tRowcnt*)(&pIndex[1]);
-  pIndex->azColl = (char**)(&pIndex->aiRowEst[nCol+1]);
+  pIndex->azColl = (char**)((char*)(&pIndex->aiRowEst[nCol+1])+nPad);
   pIndex->aiColumn = (int *)(&pIndex->azColl[nCol]);
   pIndex->aSortOrder = (u8 *)(&pIndex->aiColumn[nCol]);
   pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);
@@ -130641,7 +130645,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: sqlite3.c,v 1.2 2011/11/02 23:19:48 christos Exp $
+** $Id: sqlite3.c,v 1.3 2012/01/09 11:20:20 martin Exp $
 **
 ** This file implements an integration between the ICU library 
 ** ("International Components for Unicode", an open-source library 



Home | Main Index | Thread Index | Old Index