/ Check-in [4afdd5ae]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an out of date comment on sqlite3ArrayAllocate().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4afdd5ae53ef0ff7c0fde74eaa04638c923c679b
User & Date: dan 2012-03-29 07:51:45
Context
2012-03-29
14:29
Disable the LIKE optimization if the column on the left-hand-side of the LIKE operator belongs to a virtual table. check-in: 0bacb879 user: dan tags: trunk
07:51
Fix an out of date comment on sqlite3ArrayAllocate(). check-in: 4afdd5ae user: dan tags: trunk
2012-03-28
16:22
Avoid loading overflow pages just to satisfy typeof() or length() functions if the correct result can be computed without the extra page fetches. check-in: 0733c98c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  3036   3036     }
  3037   3037   
  3038   3038   exit_drop_index:
  3039   3039     sqlite3SrcListDelete(db, pName);
  3040   3040   }
  3041   3041   
  3042   3042   /*
  3043         -** pArray is a pointer to an array of objects.  Each object in the
  3044         -** array is szEntry bytes in size.  This routine allocates a new
  3045         -** object on the end of the array.
         3043  +** pArray is a pointer to an array of objects. Each object in the
         3044  +** array is szEntry bytes in size. This routine uses sqlite3DbRealloc()
         3045  +** to extend the array so that there is space for a new object at the end.
  3046   3046   **
  3047         -** *pnEntry is the number of entries already in use.  *pnAlloc is
  3048         -** the previously allocated size of the array.  initSize is the
  3049         -** suggested initial array size allocation.
         3047  +** When this function is called, *pnEntry contains the current size of
         3048  +** the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes
         3049  +** in total).
  3050   3050   **
  3051         -** The index of the new entry is returned in *pIdx.
         3051  +** If the realloc() is successful (i.e. if no OOM condition occurs), the
         3052  +** space allocated for the new object is zeroed, *pnEntry updated to
         3053  +** reflect the new size of the array and a pointer to the new allocation
         3054  +** returned. *pIdx is set to the index of the new array entry in this case.
  3052   3055   **
  3053         -** This routine returns a pointer to the array of objects.  This
  3054         -** might be the same as the pArray parameter or it might be a different
  3055         -** pointer if the array was resized.
         3056  +** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains
         3057  +** unchanged and a copy of pArray returned.
  3056   3058   */
  3057   3059   void *sqlite3ArrayAllocate(
  3058   3060     sqlite3 *db,      /* Connection to notify of malloc failures */
  3059   3061     void *pArray,     /* Array of objects.  Might be reallocated */
  3060   3062     int szEntry,      /* Size of each object in the array */
  3061   3063     int *pnEntry,     /* Number of objects currently in use */
  3062   3064     int *pIdx         /* Write the index of a new slot here */