Search the web
Sign In
New User? Sign Up
ClearSilver
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
something about neo_hash   Message List  
Reply | Forward Message #1306 of 1349 |
Re: something about neo_hash

#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/
>





Thu Jun 4, 2009 1:44 am

bigmaliang...
Offline Offline
Send Email Send Email

Forward
Message #1306 of 1349 |
Expand Messages Author Sort by Date

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...
bigmaliang@...
bigmaliang...
Offline Send Email
Jun 3, 2009
6:22 am

Can you provide test cases for whatever bug you think these fix? Brandon ... -- "Its much more fun to be sand than oil in the machinery of life." ...
Brandon Long
blong42
Offline Send Email
Jun 3, 2009
8:32 am

#include <stdio.h> #include <stdlib.h> #include <unistd.h> #define __USE_GNU #include <string.h> #include "ClearSilver.h" #define RETURN_V_NOK(err, v)...
bigmaliang@...
bigmaliang...
Offline Send Email
Jun 4, 2009
1:45 am

Yeap, you're right, your fixes will be in the next release. Brandon ... -- "You know your god is man-made when he hates all the same people you do." -- M....
Brandon Long
blong42
Offline Send Email
Jun 26, 2009
10:25 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help