Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > update hash table

Reply
Thread Tools

update hash table

 
 
Sergei Koveshnikov
Guest
Posts: n/a
 
      11-17-2004
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!

--
Sergei Koveshinikov.
 
Reply With Quote
 
 
 
 
=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=
Guest
Posts: n/a
 
      11-17-2004
Off-topic for c.l.c, followup-to set.

Sergei Koveshnikov <> writes:

> 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/).

--
Måns Rullgård

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hash of hash of hash of hash in c++ rp C++ 1 11-10-2011 04:45 PM
Hash#select returns an array but Hash#reject returns a hash... Srijayanth Sridhar Ruby 19 07-02-2008 12:49 PM
Table/table rows/table data tag question? Rio HTML 4 11-05-2004 08:11 AM
standard library for hash table storage and hash algorithm Pieter Claassen C Programming 1 08-04-2004 03:11 AM
Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table. David Williams ASP .Net 2 08-12-2003 07:55 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57