[sr-dev] htable add/delete RPC commands

Juha Heinanen jh at tutpro.com
Tue Feb 25 20:37:00 CET 2014


Daniel-Constantin Mierla writes:

> Again, what so ever you have as 'xyz[n]' is just seen as a string by 
> htable module, it is effectively the key in the hash table, you can add, 
> remove, get, etc..

yes, i was offline a few days and read the code.  there is no real array
in hash table, but just separate entries key[x] and key::size that tells
how many.

adding a new one could be code by setting key[key::size] and then
incrementing key::size.  deleting an entry would be more difficult,
because the hole would need to be filled with another element.

one way to improve the situation could be introduction of a new key
type, e.g., dictionary. which allows the same key to have multiple
values.  the values would then be linked from the key entry in the hash
table and there would be first(key) and next(key) functions to access
the values and delete(key) and delete(key, value) functions.

-- juha



More information about the sr-dev mailing list