mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
Use a new algorithm for sqlite3Strlen that is slightly slower but is more
like to work on a mixture of 32- and 64-bit systems. Ticket #3237, #3248. (CVS 5471) FossilOrigin-Name: cb1876d8dc102be74be98dd57ac14ee67be8e8e2
This commit is contained in:
10
src/util.c
10
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.239 2008/07/22 05:15:53 shane Exp $
|
||||
** $Id: util.c,v 1.240 2008/07/24 17:06:48 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -56,11 +56,15 @@ int sqlite3IsNaN(double x){
|
||||
*/
|
||||
int sqlite3Strlen(sqlite3 *db, const char *z){
|
||||
const char *z2 = z;
|
||||
int len;
|
||||
size_t x;
|
||||
while( *z2 ){ z2++; }
|
||||
if( z2 > &z[db->aLimit[SQLITE_LIMIT_LENGTH]] ){
|
||||
x = z2 - z;
|
||||
len = 0x7fffffff & x;
|
||||
if( len!=x || len > db->aLimit[SQLITE_LIMIT_LENGTH] ){
|
||||
return db->aLimit[SQLITE_LIMIT_LENGTH];
|
||||
}else{
|
||||
return (int)(z2 - z);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user