ferret 0.10.6 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/analysis.c +136 -107
- data/ext/analysis.h +4 -0
- data/ext/bitvector.c +2 -2
- data/ext/bitvector.h +1 -1
- data/ext/compound_io.c +4 -4
- data/ext/defines.h +0 -2
- data/ext/filter.c +3 -3
- data/ext/fs_store.c +4 -4
- data/ext/hash.c +29 -18
- data/ext/hash.h +34 -16
- data/ext/hashset.c +6 -3
- data/ext/hashset.h +1 -1
- data/ext/index.c +22 -20
- data/ext/q_boolean.c +3 -3
- data/ext/q_const_score.c +1 -1
- data/ext/q_fuzzy.c +1 -1
- data/ext/q_match_all.c +1 -1
- data/ext/q_multi_term.c +2 -2
- data/ext/q_parser.c +21 -6
- data/ext/q_phrase.c +2 -2
- data/ext/q_prefix.c +1 -1
- data/ext/q_range.c +3 -3
- data/ext/q_span.c +8 -8
- data/ext/q_term.c +1 -1
- data/ext/q_wildcard.c +1 -1
- data/ext/r_analysis.c +10 -4
- data/ext/r_index.c +89 -12
- data/ext/r_qparser.c +67 -4
- data/ext/r_search.c +11 -1
- data/ext/r_store.c +51 -35
- data/ext/ram_store.c +18 -18
- data/ext/search.c +1 -1
- data/ext/search.h +25 -23
- data/ext/similarity.c +1 -1
- data/ext/sort.c +1 -1
- data/ext/store.c +22 -3
- data/ext/store.h +8 -2
- data/lib/ferret/index.rb +14 -4
- data/lib/ferret_version.rb +1 -1
- data/test/test_helper.rb +3 -0
- data/test/unit/analysis/tc_analyzer.rb +5 -5
- data/test/unit/analysis/tc_token_stream.rb +3 -3
- data/test/unit/index/tc_index_writer.rb +1 -1
- data/test/unit/query_parser/tc_query_parser.rb +7 -5
- data/test/unit/search/tc_filter.rb +1 -1
- data/test/unit/search/tc_fuzzy_query.rb +1 -1
- data/test/unit/search/tc_index_searcher.rb +1 -1
- data/test/unit/search/tc_multi_searcher.rb +1 -1
- data/test/unit/search/tc_search_and_sort.rb +1 -1
- data/test/unit/search/tc_spans.rb +1 -1
- metadata +4 -3
data/ext/analysis.c
CHANGED
@@ -230,6 +230,43 @@ Analyzer *analyzer_new(TokenStream *ts,
|
|
230
230
|
return a;
|
231
231
|
}
|
232
232
|
|
233
|
+
/****************************************************************************
|
234
|
+
*
|
235
|
+
* Non
|
236
|
+
*
|
237
|
+
****************************************************************************/
|
238
|
+
|
239
|
+
/*
|
240
|
+
* NonTokenizer
|
241
|
+
*/
|
242
|
+
static Token *nt_next(TokenStream *ts)
|
243
|
+
{
|
244
|
+
if (ts->t) {
|
245
|
+
size_t len = strlen(ts->t);
|
246
|
+
ts->t = NULL;
|
247
|
+
|
248
|
+
return tk_set(&(CTS(ts)->token), ts->text, len, 0, len, 1);
|
249
|
+
}
|
250
|
+
else {
|
251
|
+
return NULL;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
TokenStream *non_tokenizer_new()
|
256
|
+
{
|
257
|
+
TokenStream *ts = cts_new();
|
258
|
+
ts->next = &nt_next;
|
259
|
+
return ts;
|
260
|
+
}
|
261
|
+
|
262
|
+
/*
|
263
|
+
* NonAnalyzer
|
264
|
+
*/
|
265
|
+
Analyzer *non_analyzer_new()
|
266
|
+
{
|
267
|
+
return analyzer_new(non_tokenizer_new(), NULL, NULL);
|
268
|
+
}
|
269
|
+
|
233
270
|
/****************************************************************************
|
234
271
|
*
|
235
272
|
* Whitespace
|
@@ -520,7 +557,7 @@ static int std_get_alpha(TokenStream *ts, char *token)
|
|
520
557
|
{
|
521
558
|
int i = 0;
|
522
559
|
char *t = ts->t;
|
523
|
-
while (t[i] != '\0' &&
|
560
|
+
while (t[i] != '\0' && isalnum(t[i])) {
|
524
561
|
if (i < MAX_WORD_SIZE) {
|
525
562
|
token[i] = t[i];
|
526
563
|
}
|
@@ -538,7 +575,7 @@ static int mb_std_get_alpha(TokenStream *ts, char *token)
|
|
538
575
|
|
539
576
|
i = mb_next_char(&wchr, t, &state);
|
540
577
|
|
541
|
-
while (wchr != 0 &&
|
578
|
+
while (wchr != 0 && iswalnum(wchr)) {
|
542
579
|
t += i;
|
543
580
|
i = mb_next_char(&wchr, t, &state);
|
544
581
|
}
|
@@ -820,133 +857,125 @@ static Token *std_next(TokenStream *ts)
|
|
820
857
|
}
|
821
858
|
|
822
859
|
start = t = ts->t;
|
823
|
-
|
824
|
-
|
825
|
-
|
860
|
+
token_i = std_tz->get_alpha(ts, token);
|
861
|
+
t += token_i;
|
862
|
+
|
863
|
+
if (!std_tz->is_tok_char(t)) {
|
864
|
+
/* very common case, ie a plain word, so check and return */
|
826
865
|
ts->t = t;
|
827
|
-
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
866
|
+
return tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
828
867
|
}
|
829
|
-
else {
|
830
|
-
token_i = std_tz->get_alpha(ts, token);
|
831
|
-
t += token_i;
|
832
868
|
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
869
|
+
if (*t == '\'') { /* apostrophe case. */
|
870
|
+
t += std_tz->get_apostrophe(t);
|
871
|
+
ts->t = t;
|
872
|
+
len = (int)(t - start);
|
873
|
+
/* strip possesive */
|
874
|
+
if ((t[-1] == 's' || t[-1] == 'S') && t[-2] == '\'') {
|
875
|
+
t -= 2;
|
876
|
+
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
877
|
+
CTS(ts)->token.end += 2;
|
878
|
+
}
|
879
|
+
else {
|
880
|
+
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
837
881
|
}
|
838
882
|
|
839
|
-
|
840
|
-
|
841
|
-
ts->t = t;
|
842
|
-
len = (int)(t - start);
|
843
|
-
/* strip possesive */
|
844
|
-
if ((t[-1] == 's' || t[-1] == 'S') && t[-2] == '\'') {
|
845
|
-
t -= 2;
|
846
|
-
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
847
|
-
CTS(ts)->token.end += 2;
|
848
|
-
}
|
849
|
-
else {
|
850
|
-
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
851
|
-
}
|
883
|
+
return &(CTS(ts)->token);
|
884
|
+
}
|
852
885
|
|
853
|
-
|
854
|
-
|
886
|
+
if (*t == '&') { /* apostrophe case. */
|
887
|
+
t += std_get_company_name(t);
|
888
|
+
ts->t = t;
|
889
|
+
return tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
890
|
+
}
|
855
891
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
892
|
+
if ((isdigit(*t) || isnumpunc(*t)) /* possibly a number */
|
893
|
+
&& (len = std_get_number(t) > 0)) {
|
894
|
+
num_end = start + len;
|
895
|
+
if (!std_tz->is_tok_char(num_end)) { /* won't find a longer token */
|
896
|
+
ts->t = num_end;
|
897
|
+
return tk_set_ts(&(CTS(ts)->token), start, num_end, ts->text, 1);
|
860
898
|
}
|
899
|
+
/* else there may be a longer token so check */
|
900
|
+
}
|
861
901
|
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
}
|
869
|
-
/* else there may be a longer token so check */
|
902
|
+
if (t[0] == ':' && t[1] == '/' && t[2] == '/') {
|
903
|
+
/* check for a known url start */
|
904
|
+
token[token_i] = '\0';
|
905
|
+
t += 3;
|
906
|
+
while (*t == '/') {
|
907
|
+
t++;
|
870
908
|
}
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
t++;
|
878
|
-
}
|
879
|
-
if (isalpha(*t) &&
|
880
|
-
(memcmp(token, "ftp", 3) == 0 ||
|
881
|
-
memcmp(token, "http", 4) == 0 ||
|
882
|
-
memcmp(token, "https", 5) == 0 ||
|
883
|
-
memcmp(token, "file", 4) == 0)) {
|
884
|
-
len = std_get_url(t, token, 0); /* dispose of first part of the URL */
|
885
|
-
}
|
886
|
-
else { /* still treat as url but keep the first part */
|
887
|
-
token_i = (int)(t - start);
|
888
|
-
memcpy(token, start, token_i * sizeof(char));
|
889
|
-
len = token_i + std_get_url(t, token, token_i); /* keep start */
|
890
|
-
}
|
891
|
-
ts->t = t + len;
|
892
|
-
token[len] = 0;
|
893
|
-
return tk_set(&(CTS(ts)->token), token, len, (int)(start - ts->text),
|
894
|
-
(int)(ts->t - ts->text), 1);
|
909
|
+
if (isalpha(*t) &&
|
910
|
+
(memcmp(token, "ftp", 3) == 0 ||
|
911
|
+
memcmp(token, "http", 4) == 0 ||
|
912
|
+
memcmp(token, "https", 5) == 0 ||
|
913
|
+
memcmp(token, "file", 4) == 0)) {
|
914
|
+
len = std_get_url(t, token, 0); /* dispose of first part of the URL */
|
895
915
|
}
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
916
|
+
else { /* still treat as url but keep the first part */
|
917
|
+
token_i = (int)(t - start);
|
918
|
+
memcpy(token, start, token_i * sizeof(char));
|
919
|
+
len = token_i + std_get_url(t, token, token_i); /* keep start */
|
920
|
+
}
|
921
|
+
ts->t = t + len;
|
922
|
+
token[len] = 0;
|
923
|
+
return tk_set(&(CTS(ts)->token), token, len, (int)(start - ts->text),
|
924
|
+
(int)(ts->t - ts->text), 1);
|
925
|
+
}
|
926
|
+
|
927
|
+
/* now see how long a url we can find. */
|
928
|
+
is_acronym = true;
|
929
|
+
seen_at_symbol = false;
|
930
|
+
while (isurlxatc(*t)) {
|
931
|
+
if (is_acronym && !isalpha(*t) && (*t != '.')) {
|
932
|
+
is_acronym = false;
|
933
|
+
}
|
934
|
+
if (isurlxatpunc(*t) && isurlxatpunc(t[-1])) {
|
935
|
+
break; /* can't have two punctuation characters in a row */
|
936
|
+
}
|
937
|
+
if (*t == '@') {
|
938
|
+
if (seen_at_symbol) {
|
939
|
+
break; /* we can only have one @ symbol */
|
906
940
|
}
|
907
|
-
|
908
|
-
|
909
|
-
break; /* we can only have one @ symbol */
|
910
|
-
}
|
911
|
-
else {
|
912
|
-
seen_at_symbol = true;
|
913
|
-
}
|
941
|
+
else {
|
942
|
+
seen_at_symbol = true;
|
914
943
|
}
|
915
|
-
t++;
|
916
|
-
}
|
917
|
-
while (isurlxatpunc(t[-1])) {
|
918
|
-
t--; /* strip trailing punctuation */
|
919
944
|
}
|
945
|
+
t++;
|
946
|
+
}
|
947
|
+
while (isurlxatpunc(t[-1])) {
|
948
|
+
t--; /* strip trailing punctuation */
|
949
|
+
}
|
920
950
|
|
921
|
-
|
922
|
-
|
951
|
+
if (num_end == NULL || t > num_end) {
|
952
|
+
ts->t = t;
|
923
953
|
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
}
|
954
|
+
if (is_acronym) { /* check it is one letter followed by one '.' */
|
955
|
+
for (s = start; s < t - 1; s++) {
|
956
|
+
if (isalpha(*s) && (s[1] != '.'))
|
957
|
+
is_acronym = false;
|
929
958
|
}
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
959
|
+
}
|
960
|
+
if (is_acronym) { /* strip '.'s */
|
961
|
+
for (s = start + token_i; s < t; s++) {
|
962
|
+
if (*s != '.') {
|
963
|
+
token[token_i] = *s;
|
964
|
+
token_i++;
|
936
965
|
}
|
937
|
-
tk_set(&(CTS(ts)->token), token, token_i,
|
938
|
-
(int)(start - ts->text),
|
939
|
-
(int)(t - ts->text), 1);
|
940
|
-
}
|
941
|
-
else { /* just return the url as is */
|
942
|
-
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
943
966
|
}
|
967
|
+
tk_set(&(CTS(ts)->token), token, token_i,
|
968
|
+
(int)(start - ts->text),
|
969
|
+
(int)(t - ts->text), 1);
|
944
970
|
}
|
945
|
-
else {
|
946
|
-
ts->t
|
947
|
-
tk_set_ts(&(CTS(ts)->token), start, num_end, ts->text, 1);
|
971
|
+
else { /* just return the url as is */
|
972
|
+
tk_set_ts(&(CTS(ts)->token), start, t, ts->text, 1);
|
948
973
|
}
|
949
974
|
}
|
975
|
+
else { /* return the number */
|
976
|
+
ts->t = num_end;
|
977
|
+
tk_set_ts(&(CTS(ts)->token), start, num_end, ts->text, 1);
|
978
|
+
}
|
950
979
|
|
951
980
|
return &(CTS(ts)->token);
|
952
981
|
}
|
data/ext/analysis.h
CHANGED
@@ -112,6 +112,8 @@ typedef struct StemFilter
|
|
112
112
|
|
113
113
|
extern void ts_deref(TokenStream *ts);
|
114
114
|
|
115
|
+
extern TokenStream *non_tokenizer_new();
|
116
|
+
|
115
117
|
extern TokenStream *whitespace_tokenizer_new();
|
116
118
|
extern TokenStream *mb_whitespace_tokenizer_new(bool lowercase);
|
117
119
|
|
@@ -172,6 +174,8 @@ extern Analyzer *analyzer_new(TokenStream *ts,
|
|
172
174
|
char *field,
|
173
175
|
char *text));
|
174
176
|
extern void a_standard_destroy(Analyzer *a);
|
177
|
+
extern Analyzer *non_analyzer_new();
|
178
|
+
|
175
179
|
extern Analyzer *whitespace_analyzer_new(bool lowercase);
|
176
180
|
extern Analyzer *mb_whitespace_analyzer_new(bool lowercase);
|
177
181
|
|
data/ext/bitvector.c
CHANGED
@@ -345,9 +345,9 @@ int bv_eq(BitVector *bv1, BitVector *bv2)
|
|
345
345
|
return true;
|
346
346
|
}
|
347
347
|
|
348
|
-
|
348
|
+
unsigned long bv_hash(BitVector *bv)
|
349
349
|
{
|
350
|
-
|
350
|
+
unsigned long hash = 0;
|
351
351
|
const f_u32 empty_word = bv->extends_as_ones ? 0xFFFFFFFF : 0;
|
352
352
|
int i;
|
353
353
|
for (i = (bv->size >> 5); i >= 0; i--) {
|
data/ext/bitvector.h
CHANGED
@@ -193,7 +193,7 @@ extern int bv_eq(BitVector *bv1, BitVector *bv2);
|
|
193
193
|
* @param bv the BitVector to hash
|
194
194
|
* @return A hash value for the BitVector
|
195
195
|
*/
|
196
|
-
extern
|
196
|
+
extern unsigned long bv_hash(BitVector *bv);
|
197
197
|
|
198
198
|
/**
|
199
199
|
* ANDs two BitVectors (+bv1+ and +bv2+) together and return the resultant
|
data/ext/compound_io.c
CHANGED
@@ -181,7 +181,7 @@ static OutStream *cmpd_new_output(Store *store, const char *file_name)
|
|
181
181
|
return NULL;
|
182
182
|
}
|
183
183
|
|
184
|
-
static Lock *
|
184
|
+
static Lock *cmpd_open_lock_i(Store *store, char *lock_name)
|
185
185
|
{
|
186
186
|
(void)store;
|
187
187
|
(void)lock_name;
|
@@ -189,7 +189,7 @@ static Lock *cmpd_open_lock(Store *store, char *lock_name)
|
|
189
189
|
return NULL;
|
190
190
|
}
|
191
191
|
|
192
|
-
static void
|
192
|
+
static void cmpd_close_lock_i(Lock *lock)
|
193
193
|
{
|
194
194
|
(void)lock;
|
195
195
|
RAISE(UNSUPPORTED_ERROR, UNSUPPORTED_ERROR_MSG);
|
@@ -246,8 +246,8 @@ Store *open_cmpd_store(Store *store, const char *name)
|
|
246
246
|
new_store->close_i = &cmpd_close_i;
|
247
247
|
new_store->new_output = &cmpd_new_output;
|
248
248
|
new_store->open_input = &cmpd_open_input;
|
249
|
-
new_store->
|
250
|
-
new_store->
|
249
|
+
new_store->open_lock_i = &cmpd_open_lock_i;
|
250
|
+
new_store->close_lock_i = &cmpd_close_lock_i;
|
251
251
|
|
252
252
|
return new_store;
|
253
253
|
}
|
data/ext/defines.h
CHANGED
data/ext/filter.c
CHANGED
@@ -41,7 +41,7 @@ static char *filt_to_s_i(Filter *filt)
|
|
41
41
|
return estrdup(filt->name);
|
42
42
|
}
|
43
43
|
|
44
|
-
|
44
|
+
unsigned long filt_hash_default(Filter *filt)
|
45
45
|
{
|
46
46
|
(void)filt;
|
47
47
|
return 0;
|
@@ -66,7 +66,7 @@ Filter *filt_create(size_t size, const char *name)
|
|
66
66
|
return filt;
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
unsigned long filt_hash(Filter *filt)
|
70
70
|
{
|
71
71
|
return str_hash(filt->name) ^ filt->hash(filt);
|
72
72
|
}
|
@@ -118,7 +118,7 @@ static BitVector *qfilt_get_bv_i(Filter *filt, IndexReader *ir)
|
|
118
118
|
return bv;
|
119
119
|
}
|
120
120
|
|
121
|
-
static
|
121
|
+
static unsigned long qfilt_hash(Filter *filt)
|
122
122
|
{
|
123
123
|
return q_hash(QF(filt)->query);
|
124
124
|
}
|
data/ext/fs_store.c
CHANGED
@@ -384,7 +384,7 @@ void fs_lock_release(Lock *lock)
|
|
384
384
|
remove(lock->name);
|
385
385
|
}
|
386
386
|
|
387
|
-
static Lock *
|
387
|
+
static Lock *fs_open_lock_i(Store *store, char *lockname)
|
388
388
|
{
|
389
389
|
Lock *lock = ALLOC(Lock);
|
390
390
|
char lname[100];
|
@@ -398,7 +398,7 @@ static Lock *fs_open_lock(Store *store, char *lockname)
|
|
398
398
|
return lock;
|
399
399
|
}
|
400
400
|
|
401
|
-
static void
|
401
|
+
static void fs_close_lock_i(Lock *lock)
|
402
402
|
{
|
403
403
|
remove(lock->name);
|
404
404
|
free(lock->name);
|
@@ -447,8 +447,8 @@ static Store *fs_store_new(const char *pathname)
|
|
447
447
|
new_store->each = &fs_each;
|
448
448
|
new_store->new_output = &fs_new_output;
|
449
449
|
new_store->open_input = &fs_open_input;
|
450
|
-
new_store->
|
451
|
-
new_store->
|
450
|
+
new_store->open_lock_i = &fs_open_lock_i;
|
451
|
+
new_store->close_lock_i = &fs_close_lock_i;
|
452
452
|
return new_store;
|
453
453
|
}
|
454
454
|
|
data/ext/hash.c
CHANGED
@@ -18,16 +18,16 @@ static char *dummy_key = "";
|
|
18
18
|
static HashTable *free_hts[MAX_FREE_HASH_TABLES];
|
19
19
|
static int num_free_hts = 0;
|
20
20
|
|
21
|
-
|
21
|
+
unsigned long *imalloc(unsigned long value)
|
22
22
|
{
|
23
|
-
|
23
|
+
unsigned long *p = ALLOC(unsigned long);
|
24
24
|
*p = value;
|
25
25
|
return p;
|
26
26
|
}
|
27
27
|
|
28
|
-
|
28
|
+
unsigned long str_hash(const char *const str)
|
29
29
|
{
|
30
|
-
register
|
30
|
+
register unsigned long h = 0;
|
31
31
|
register unsigned char *p = (unsigned char *) str;
|
32
32
|
|
33
33
|
for (; *p; p++) {
|
@@ -37,6 +37,16 @@ ulong str_hash(const char *const str)
|
|
37
37
|
return h;
|
38
38
|
}
|
39
39
|
|
40
|
+
unsigned long ptr_hash(const void *const ptr)
|
41
|
+
{
|
42
|
+
return (unsigned long)ptr;
|
43
|
+
}
|
44
|
+
|
45
|
+
int ptr_eq(const void *q1, const void *q2)
|
46
|
+
{
|
47
|
+
return q1 == q2;
|
48
|
+
}
|
49
|
+
|
40
50
|
static int int_eq(const void *q1, const void *q2)
|
41
51
|
{
|
42
52
|
(void)q1;
|
@@ -44,9 +54,9 @@ static int int_eq(const void *q1, const void *q2)
|
|
44
54
|
return true;
|
45
55
|
}
|
46
56
|
|
47
|
-
static
|
57
|
+
static unsigned long int_hash(const void *i)
|
48
58
|
{
|
49
|
-
return *((
|
59
|
+
return *((unsigned long *)i);
|
50
60
|
}
|
51
61
|
|
52
62
|
typedef HashEntry *(*lookup_ft)(struct HashTable *ht, register const void *key);
|
@@ -58,9 +68,10 @@ typedef HashEntry *(*lookup_ft)(struct HashTable *ht, register const void *key);
|
|
58
68
|
* @param ht the HashTable to do the fast lookup in
|
59
69
|
* @param the hashkey we are looking for
|
60
70
|
*/
|
61
|
-
static __inline HashEntry *h_resize_lookup(HashTable *ht,
|
71
|
+
static __inline HashEntry *h_resize_lookup(HashTable *ht,
|
72
|
+
register const unsigned long hash)
|
62
73
|
{
|
63
|
-
register
|
74
|
+
register unsigned long perturb;
|
64
75
|
register int mask = ht->mask;
|
65
76
|
register HashEntry *he0 = ht->table;
|
66
77
|
register int i = hash & mask;
|
@@ -83,8 +94,8 @@ static __inline HashEntry *h_resize_lookup(HashTable *ht, register const ulong h
|
|
83
94
|
|
84
95
|
HashEntry *h_lookup_int(HashTable *ht, const void *key)
|
85
96
|
{
|
86
|
-
register
|
87
|
-
register
|
97
|
+
register unsigned long hash = *((int *)key);
|
98
|
+
register unsigned long perturb;
|
88
99
|
register int mask = ht->mask;
|
89
100
|
register HashEntry *he0 = ht->table;
|
90
101
|
register int i = hash & mask;
|
@@ -120,8 +131,8 @@ HashEntry *h_lookup_int(HashTable *ht, const void *key)
|
|
120
131
|
|
121
132
|
HashEntry *h_lookup_str(HashTable *ht, register const char *key)
|
122
133
|
{
|
123
|
-
register
|
124
|
-
register
|
134
|
+
register unsigned long hash = str_hash(key);
|
135
|
+
register unsigned long perturb;
|
125
136
|
register int mask = ht->mask;
|
126
137
|
register HashEntry *he0 = ht->table;
|
127
138
|
register int i = hash & mask;
|
@@ -477,32 +488,32 @@ int h_has_key(HashTable *ht, const void *key)
|
|
477
488
|
}
|
478
489
|
}
|
479
490
|
|
480
|
-
void *h_get_int(HashTable *self, const
|
491
|
+
void *h_get_int(HashTable *self, const unsigned long key)
|
481
492
|
{
|
482
493
|
return h_get(self, &key);
|
483
494
|
}
|
484
495
|
|
485
|
-
int h_del_int(HashTable *self, const
|
496
|
+
int h_del_int(HashTable *self, const unsigned long key)
|
486
497
|
{
|
487
498
|
return h_del(self, &key);
|
488
499
|
}
|
489
500
|
|
490
|
-
void *h_rem_int(HashTable *self, const
|
501
|
+
void *h_rem_int(HashTable *self, const unsigned long key)
|
491
502
|
{
|
492
503
|
return h_rem(self, &key, false);
|
493
504
|
}
|
494
505
|
|
495
|
-
int h_set_int(HashTable *self, const
|
506
|
+
int h_set_int(HashTable *self, const unsigned long key, void *value)
|
496
507
|
{
|
497
508
|
return h_set(self, &key, value);
|
498
509
|
}
|
499
510
|
|
500
|
-
int h_set_safe_int(HashTable *self, const
|
511
|
+
int h_set_safe_int(HashTable *self, const unsigned long key, void *value)
|
501
512
|
{
|
502
513
|
return h_set_safe(self, &key, value);
|
503
514
|
}
|
504
515
|
|
505
|
-
int h_has_key_int(HashTable *self, const
|
516
|
+
int h_has_key_int(HashTable *self, const unsigned long key)
|
506
517
|
{
|
507
518
|
return h_has_key(self, &key);
|
508
519
|
}
|