1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-03 16:53:36 +03:00

Bug fix when -DMEMORY_DEBUG is off. (CVS 407)

FossilOrigin-Name: e14b0c82f3514f41934a7c0d173b6fdb186aafc8
This commit is contained in:
drh
2002-02-28 04:10:29 +00:00
parent 47c8a67907
commit 567c604bb5
3 changed files with 14 additions and 10 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.39 2002/02/28 00:41:11 drh Exp $
** $Id: util.c,v 1.40 2002/02/28 04:10:30 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -255,12 +255,16 @@ void *sqliteRealloc(void *p, int n){
** Make a copy of a string in memory obtained from sqliteMalloc()
*/
char *sqliteStrDup(const char *z){
char *zNew = sqliteMalloc(strlen(z)+1);
char *zNew;
if( z==0 ) return 0;
zNew = sqliteMalloc(strlen(z)+1);
if( zNew ) strcpy(zNew, z);
return zNew;
}
char *sqliteStrNDup(const char *z, int n){
char *zNew = sqliteMalloc(n+1);
char *zNew;
if( z==0 ) return 0;
zNew = sqliteMalloc(n+1);
if( zNew ){
memcpy(zNew, z, n);
zNew[n] = 0;