Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure hash functions always return non-negative. (CVS 969) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
39a3e403f0440acb2f85a064ec23d404 |
User & Date: | drh 2003-05-12 23:06:53.000 |
Context
2003-05-13
| ||
00:21 | Fix a #ifdefs that are used to comment-out the VACUUM command. (CVS 970) (check-in: 22d5324073 user: drh tags: trunk) | |
2003-05-12
| ||
23:06 | Make sure hash functions always return non-negative. (CVS 969) (check-in: 39a3e403f0 user: drh tags: trunk) | |
2003-05-11
| ||
20:09 | Changed PRAGMA database_list to show the filename. (CVS 968) (check-in: 3da10d2d02 user: jplyon tags: trunk) | |
Changes
Changes to src/hash.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This is the implementation of generic hash-tables ** used in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This is the implementation of generic hash-tables ** used in SQLite. ** ** $Id: hash.c,v 1.10 2003/05/12 23:06:53 drh Exp $ */ #include "sqliteInt.h" #include <assert.h> /* Turn bulk memory into a hash table object by initializing the ** fields of the Hash structure. ** |
︙ | ︙ | |||
104 105 106 107 108 109 110 | */ static int binHash(const void *pKey, int nKey){ int h = 0; const char *z = (const char *)pKey; while( nKey-- > 0 ){ h = (h<<3) ^ h ^ *(z++); } | < | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | */ static int binHash(const void *pKey, int nKey){ int h = 0; const char *z = (const char *)pKey; while( nKey-- > 0 ){ h = (h<<3) ^ h ^ *(z++); } return h & 0x7fffffff; } static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){ if( n1!=n2 ) return n2-n1; return memcmp(pKey1,pKey2,n1); } /* |
︙ | ︙ |
Changes to src/util.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** ** $Id: util.c,v 1.63 2003/05/12 23:06:53 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> #include <ctype.h> /* ** If malloc() ever fails, this global variable gets set to 1. |
︙ | ︙ | |||
584 585 586 587 588 589 590 | int sqliteHashNoCase(const char *z, int n){ int h = 0; if( n<=0 ) n = strlen(z); while( n > 0 ){ h = (h<<3) ^ h ^ UpperToLower[(unsigned char)*z++]; n--; } | < | | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | int sqliteHashNoCase(const char *z, int n){ int h = 0; if( n<=0 ) n = strlen(z); while( n > 0 ){ h = (h<<3) ^ h ^ UpperToLower[(unsigned char)*z++]; n--; } return h & 0x7fffffff; } /* ** Some systems have stricmp(). Others have strcasecmp(). Because ** there is no consistency, we will define our own. */ int sqliteStrICmp(const char *zLeft, const char *zRight){ |
︙ | ︙ |