Re: something about neo_hash

Brandon Long <[email protected]> Fri, 26 Jun 2009 15:24:39 -0700
Newsgroups gmane.text.clearsilver.general
Organization Fiction L Networks
Message-ID <20090626222439.GA30335@bl1>
Yeap, you're right, your fixes will be in the next release.

Brandon

On 06/04/09 [email protected] uttered the following other thing:
> #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 [email protected], 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/
> >
> 
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 
-- 
  "You know your god is man-made when he hates all the same people you do."
     -- M. Surber, 8/18/1996
                                             http://www.fiction.net/blong/