pike.git/
src/
mapping.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-01-28
2000-01-28 00:46:26 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
9001b4b47ba46b3871b033c894161128874c9b32 (
74
lines) (+
47
/-
27
)
[
Show
|
Annotate
]
Branch:
7.9
oops, bugfix in mapping_search
Rev: src/mapping.c:1.50
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: mapping.c,v 1.
49
2000/01/
27
23
:
18
:
25
hubbe Exp $");
+
RCSID("$Id: mapping.c,v 1.
50
2000/01/
28
00
:
46
:
26
hubbe Exp $");
#include "main.h" #include "object.h" #include "mapping.h"
1440:
struct svalue *look_for, struct svalue *key /* start */) {
-
unsigned INT32 h2,h=0;
-
struct keypair *k=0, **prev;
+
struct mapping_data *md, *omd; #ifdef PIKE_DEBUG if(m->data->refs <=0) fatal("Zero refs i mapping->data\n"); #endif
-
+
md=m->data;
-
+
if(md->size)
+
{
+
unsigned INT32 h2,h=0;
+
struct keypair *k=md->hash[0], **prev;
+
if(key) { h2=hash_svalue(key); FIND();
-
+
+
if(!k)
+
{
+
to->type=T_INT;
+
to->subtype=NUMBER_UNDEFINED;
+
to->u.integer=0;
+
return;
}
-
+
}
md=m->data;
1463:
md->valrefs++; add_ref(md);
-
while
(h < (unsigned INT32)md->hashsize)
+
if
(h < (unsigned INT32)md->hashsize)
{
-
+
while(1)
+
{
while(k) { if(is_eq(look_for, &k->val))
1477:
} k=k->next; }
-
k=md->hash[
++h
];
+
h++;
+
if(h>= (unsigned INT32)md->hashsize)
+
break;
+
k=md->hash[
h
];
} }
-
+
}
md->valrefs--; free_mapping_data(md);
-
+
}
to->type=T_INT; to->subtype=NUMBER_UNDEFINED;