diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index 59f1b805a..20be6d728 100644 --- a/src/util.c +++ b/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.244 2008/12/10 21:19:57 drh Exp $ +** $Id: util.c,v 1.245 2008/12/10 22:15:00 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -51,6 +51,16 @@ int sqlite3IsNaN(double x){ } /* +** Compute a string length that is limited to what can be stored in +** lower 30 bits of a 32-bit signed integer. +*/ +int sqlite3Strlen30(const char *z){ + const char *z2 = z; + while( *z2 ){ z2++; } + return 0x3fffffff & (int)(z2 - z); +} + +/* ** Return the length of a string, except do not allow the string length ** to exceed the SQLITE_LIMIT_LENGTH setting. */ |