1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Remove the OP_HexBlob instruction and code OP_Blob directly. Reduce

the amount of memory allocation required to encode blob literals.
Remove the "out2" instruction type.  Other minor optimizations. (CVS 4726)

FossilOrigin-Name: 0e50c0200a3c1c04e63cbb55a7255cdbbd225347
This commit is contained in:
drh
2008-01-18 14:08:24 +00:00
parent a98d7b4797
commit ca48c90f60
8 changed files with 49 additions and 86 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.213 2007/10/23 15:39:45 drh Exp $
** $Id: util.c,v 1.214 2008/01/18 14:08:25 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -637,17 +637,17 @@ static int hexToInt(int h){
** binary value has been obtained from malloc and must be freed by
** the calling routine.
*/
void *sqlite3HexToBlob(sqlite3 *db, const char *z){
void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){
char *zBlob;
int i;
int n = strlen(z);
if( n%2 ) return 0;
zBlob = (char *)sqlite3DbMallocRaw(db, n/2);
zBlob = (char *)sqlite3DbMallocRaw(db, n/2 + 1);
n--;
if( zBlob ){
for(i=0; i<n; i+=2){
zBlob[i/2] = (hexToInt(z[i])<<4) | hexToInt(z[i+1]);
}
zBlob[i/2] = 0;
}
return zBlob;
}