#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define __USE_GNU
#include <string.h>
#include "ClearSilver.h"
#define RETURN_V_NOK(err, v) \
if (err != STATUS_OK) { \
STRING zstra; string_init(&zstra); \
nerr_error_traceback(err, &zstra); \
printf("%s", zstra.buf); \
string_clear(&zstra); \
nerr_ignore(&err); \
return v; \
}
int main(int argc, char **argv)
{
HASH *hs;
NEOERR *err;
err = hash_init(&hs, hash_str_hash, hash_str_comp);
RETURN_V_NOK(err, 1);
err = hash_insert(hs, "1", "one");
RETURN_V_NOK(err, 1);
err = hash_insert(hs, "2", "two");
RETURN_V_NOK(err, 1);
err = hash_insert(hs, "3", "three");
RETURN_V_NOK(err, 1);
char *val, *key = NULL;
val = (char*)hash_next(hs, (void**)&key);
while (val != NULL) {
printf("get key %s val %s\n", key, val);
val = (char*)hash_next(hs, (void**)&key);
}
hash_destroy(&hs);
return 0;
}
or, you can get it from http://www.box.net/shared/181lf0jbh5
thaks
--- In ClearSilver@yahoogroups.com, Brandon Long <blong@...> wrote:
>
> Can you provide test cases for whatever bug you think these fix?
>
> Brandon
>
> On 06/03/09 bigmaliang@... uttered the following other thing:
> > Hi,
> >
> > This is something confused me in neo_hash mode:
> >
> > 1, dose neo_hash.c line 146 should change to
> >
> > node = _hash_lookup_node(hash, *key, NULL);
> >
> >
> > 2, and before we judge if (*node) in line 163, should we judge if
(node) first ? Because the *key parameter can be null, and so node is
null.
> >
> >
> > 3, it seems that
> >
> > #define hash_insert ne_hash_insert
> >
> > is missing in ClearSilver.h
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> --
> "Its much more fun to be sand than oil in the machinery of life."
>
http://www.fiction.net/blong/
>