Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/sqlite/sqlite3.c

    r595 r846  
    4845348453
    4845448454/*
    48455 ** Allocate space from a fixed size buffer.  Make *pp point to the
    48456 ** allocated space.  (Note:  pp is a char* rather than a void** to
    48457 ** work around the pointer aliasing rules of C.)  *pp should initially
    48458 ** be zero.  If *pp is not zero, that means that the space has already
    48459 ** been allocated and this routine is a noop.
     48455** Allocate space from a fixed size buffer and return a pointer to
     48456** that space.  If insufficient space is available, return NULL.
     48457**
     48458** The pBuf parameter is the initial value of a pointer which will
     48459** receive the new memory.  pBuf is normally NULL.  If pBuf is not
     48460** NULL, it means that memory space has already been allocated and that
     48461** this routine should not allocate any new memory.  When pBuf is not
     48462** NULL simply return pBuf.  Only allocate new memory space when pBuf
     48463** is NULL.
    4846048464**
    4846148465** nByte is the number of bytes of space needed.
     
    4846848472** request, then increment *pnByte by the amount of the request.
    4846948473*/
    48470 static void allocSpace(
    48471   char *pp,            /* IN/OUT: Set *pp to point to allocated buffer */
     48474static void allocSpace(
     48475  */
    4847248476  int nByte,           /* Number of bytes to allocate */
    4847348477  u8 **ppFrom,         /* IN/OUT: Allocate from *ppFrom */
     
    4847648480){
    4847748481  assert( EIGHT_BYTE_ALIGNMENT(*ppFrom) );
    48478   if( (*(void**)pp)==0 ){
    48479     nByte = ROUND8(nByte);
    48480     if( &(*ppFrom)[nByte] <= pEnd ){
    48481       *(void**)pp = (void *)*ppFrom;
    48482       *ppFrom += nByte;
    48483     }else{
    48484       *pnByte += nByte;
    48485     }
    48486   }
     48482  if(
     48483  nByte = ROUND8(nByte);
     48484  if( &(*ppFrom)[nByte] <= pEnd ){
     48485    *)*ppFrom;
     48486    *ppFrom += nByte;
     48487  }else{
     48488    *pnByte += nByte;
     48489  }
     48490 
    4848748491}
    4848848492
     
    4855748561    do {
    4855848562      nByte = 0;
    48559       allocSpace((char*)&p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
    48560       allocSpace((char*)&p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);
    48561       allocSpace((char*)&p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
    48562       allocSpace((char*)&p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);
    48563       allocSpace((char*)&p->apCsr,
    48564                  nCursor*sizeof(VdbeCursor*), &zCsr, zEnd, &nByte
    48565       );
     48563      p->aMem = allocSpace(p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
     48564      p->aVar = allocSpace(p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);
     48565      p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
     48566      p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte);
     48567      p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*),
     48568                            &zCsr, zEnd, &nByte);
    4856648569      if( nByte ){
    4856748570        p->pFree = sqlite3DbMallocZero(db, nByte);
Note: See TracChangeset for help on using the changeset viewer.