update hash table

S

Sergei Koveshnikov

Hello,

I am trying to use hash management (from <search.h>).
I can add and search however I can't update entries in the hash table...
In the manual I found following note:
============
man (3) HSEARCH
SVID and POSIX 1003.1-2001 specify that action is significant only for
unsuccessful searches, so that an ENTER should not do anything for a
successful search. The libc and glibc implementations update the data
for the given key in this case.
Individual hash table entries can be added, but not deleted
============

Could you look at my example in the attached file `hash.c'
and give me some hints?

$ gcc -D_GNU_SOURCE -o hash hash.c
$ ./hash
Value: yes
Value: yes
$


I'm using:
============
gcc version 3.3.4
Linux aldan 2.4.27-1-386 #1 Fri Sep 3 06:24:46 UTC 2004 i686 GNU/Linux
============

Thanks a lot!
 
?

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

Off-topic for c.l.c, followup-to set.

Sergei Koveshnikov said:
Hello,

I am trying to use hash management (from <search.h>).
I can add and search however I can't update entries in the hash table...
In the manual I found following note:
============
man (3) HSEARCH
SVID and POSIX 1003.1-2001 specify that action is significant only for
unsuccessful searches, so that an ENTER should not do anything for a
successful search. The libc and glibc implementations update the data
for the given key in this case.
Individual hash table entries can be added, but not deleted
============

Could you look at my example in the attached file `hash.c'
and give me some hints?

The standard hash table API is horribly broken, and not even portable
among different Unixes (opposite return values from hsearch_r() in
glibc vs. Tru64). You might want to take a look at the hash tables in
my libtc library (http://libtc.sf.net/).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,394
Latest member
Olekdev

Latest Threads

Top