mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
The sqlite3_value object now carries an sqlite3* pointer to use for
recording malloc failures. This eliminates the need to pass sqlite3* pointers into many internal interfaces. Also added more mutexing. (CVS 4263) FossilOrigin-Name: 9287276191a582c1cf7cf6b71d8399727d8e534d
This commit is contained in:
10
src/func.c
10
src/func.c
@@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.167 2007/08/21 10:44:16 drh Exp $
|
||||
** $Id: func.c,v 1.168 2007/08/21 19:33:56 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -1062,13 +1062,13 @@ static void test_destructor(
|
||||
test_destructor_count_var++;
|
||||
assert( nArg==1 );
|
||||
if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
|
||||
len = sqlite3ValueBytes(0, argv[0], ENC(db));
|
||||
len = sqlite3ValueBytes(argv[0], ENC(db));
|
||||
zVal = sqlite3MallocZero(len+3);
|
||||
zVal[len] = 0;
|
||||
zVal[len-1] = 0;
|
||||
assert( zVal );
|
||||
zVal++;
|
||||
memcpy(zVal, sqlite3ValueText(0, argv[0], ENC(db)), len);
|
||||
memcpy(zVal, sqlite3ValueText(argv[0], ENC(db)), len);
|
||||
if( ENC(db)==SQLITE_UTF8 ){
|
||||
sqlite3_result_text(pCtx, zVal, -1, destructor);
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
@@ -1271,10 +1271,10 @@ static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv)
|
||||
max = sqlite3_user_data(context)!=0;
|
||||
cmp = sqlite3MemCompare(pBest, pArg, pColl);
|
||||
if( (max && cmp<0) || (!max && cmp>0) ){
|
||||
sqlite3VdbeMemCopy(0, pBest, pArg);
|
||||
sqlite3VdbeMemCopy(pBest, pArg);
|
||||
}
|
||||
}else{
|
||||
sqlite3VdbeMemCopy(0, pBest, pArg);
|
||||
sqlite3VdbeMemCopy(pBest, pArg);
|
||||
}
|
||||
}
|
||||
static void minMaxFinalize(sqlite3_context *context){
|
||||
|
||||
Reference in New Issue
Block a user