mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Initial check-in of the code for the new sqlite_set_authorizer() API function.
The code is mostly untested at this point. (CVS 827) FossilOrigin-Name: 52d5007f64d0af5286b2a0e1f0b9e53c86bece3f
This commit is contained in:
20
src/util.c
20
src/util.c
@@ -14,7 +14,7 @@
|
||||
** This file contains functions for allocating memory, comparing
|
||||
** strings, and stuff like that.
|
||||
**
|
||||
** $Id: util.c,v 1.54 2003/01/02 14:43:57 drh Exp $
|
||||
** $Id: util.c,v 1.55 2003/01/12 18:02:19 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -84,6 +84,24 @@ void *sqliteMalloc_(int n, int bZero, char *zFile, int line){
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to see if the given pointer was obtained from sqliteMalloc()
|
||||
** and is able to hold at least N bytes. Raise an exception if this
|
||||
** is not the case.
|
||||
**
|
||||
** This routine is used for testing purposes only.
|
||||
*/
|
||||
void sqliteCheckMemory(void *p, int N){
|
||||
int *pi = p;
|
||||
int n, k;
|
||||
pi -= 2;
|
||||
assert( pi[0]==0xdead1122 );
|
||||
n = pi[1];
|
||||
assert( N>=0 && N<n );
|
||||
k = (n+sizeof(int)-1)/sizeof(int);
|
||||
assert( pi[k+2]==0xdead3344 );
|
||||
}
|
||||
|
||||
/*
|
||||
** Free memory previously obtained from sqliteMalloc()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user