Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/sqlite/sqlite-src-3100200/src/mem1.c

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2007 August 14 2 ** 2007 August 14
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined. 72 ** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
73 */ 73 */
74 #define SQLITE_MALLOC(x) malloc(x) 74 #define SQLITE_MALLOC(x) malloc(x)
75 #define SQLITE_FREE(x) free(x) 75 #define SQLITE_FREE(x) free(x)
76 #define SQLITE_REALLOC(x,y) realloc((x),(y)) 76 #define SQLITE_REALLOC(x,y) realloc((x),(y))
77 77
78 /* 78 /*
79 ** The malloc.h header file is needed for malloc_usable_size() function 79 ** The malloc.h header file is needed for malloc_usable_size() function
80 ** on some systems (e.g. Linux). 80 ** on some systems (e.g. Linux).
81 */ 81 */
82 #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE) 82 #if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE
83 # define SQLITE_USE_MALLOC_H 83 # define SQLITE_USE_MALLOC_H 1
84 # define SQLITE_USE_MALLOC_USABLE_SIZE 84 # define SQLITE_USE_MALLOC_USABLE_SIZE 1
85 /* 85 /*
86 ** The MSVCRT has malloc_usable_size(), but it is called _msize(). The 86 ** The MSVCRT has malloc_usable_size(), but it is called _msize(). The
87 ** use of _msize() is automatic, but can be disabled by compiling with 87 ** use of _msize() is automatic, but can be disabled by compiling with
88 ** -DSQLITE_WITHOUT_MSIZE. Using the _msize() function also requires 88 ** -DSQLITE_WITHOUT_MSIZE. Using the _msize() function also requires
89 ** the malloc.h header file. 89 ** the malloc.h header file.
90 */ 90 */
91 #elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE) 91 #elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)
92 # define SQLITE_USE_MALLOC_H 92 # define SQLITE_USE_MALLOC_H
93 # define SQLITE_USE_MSIZE 93 # define SQLITE_USE_MSIZE
94 #endif 94 #endif
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SQLITE_FREE(p); 165 SQLITE_FREE(p);
166 #endif 166 #endif
167 } 167 }
168 168
169 /* 169 /*
170 ** Report the allocated size of a prior return from xMalloc() 170 ** Report the allocated size of a prior return from xMalloc()
171 ** or xRealloc(). 171 ** or xRealloc().
172 */ 172 */
173 static int sqlite3MemSize(void *pPrior){ 173 static int sqlite3MemSize(void *pPrior){
174 #ifdef SQLITE_MALLOCSIZE 174 #ifdef SQLITE_MALLOCSIZE
175 return pPrior ? (int)SQLITE_MALLOCSIZE(pPrior) : 0; 175 assert( pPrior!=0 );
176 return (int)SQLITE_MALLOCSIZE(pPrior);
176 #else 177 #else
177 sqlite3_int64 *p; 178 sqlite3_int64 *p;
178 if( pPrior==0 ) return 0; 179 assert( pPrior!=0 );
179 p = (sqlite3_int64*)pPrior; 180 p = (sqlite3_int64*)pPrior;
180 p--; 181 p--;
181 return (int)p[0]; 182 return (int)p[0];
182 #endif 183 #endif
183 } 184 }
184 185
185 /* 186 /*
186 ** Like realloc(). Resize an allocation previously obtained from 187 ** Like realloc(). Resize an allocation previously obtained from
187 ** sqlite3MemMalloc(). 188 ** sqlite3MemMalloc().
188 ** 189 **
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 sqlite3MemSize, 287 sqlite3MemSize,
287 sqlite3MemRoundup, 288 sqlite3MemRoundup,
288 sqlite3MemInit, 289 sqlite3MemInit,
289 sqlite3MemShutdown, 290 sqlite3MemShutdown,
290 0 291 0
291 }; 292 };
292 sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); 293 sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
293 } 294 }
294 295
295 #endif /* SQLITE_SYSTEM_MALLOC */ 296 #endif /* SQLITE_SYSTEM_MALLOC */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/src/mem0.c ('k') | third_party/sqlite/sqlite-src-3100200/src/mem2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698