Skip to content
  • Thomas Haller's avatar
    all: refactor hashing by introducing NMHashState · 0e9e35e3
    Thomas Haller authored
    The privious NM_HASH_* macros directly operated on a guint value
    and were thus close to the actual implementation.
    
    Replace them by adding a NMHashState struct and accessors to
    update the hash state. This hides the implementation better
    and would allow us to carry more state. For example, we could
    switch to siphash24() transparently.
    
    For now, we still do a form basically djb2 hashing, albeit with
    differing start seed.
    
    Also add nm_hash_str() and nm_str_hash():
    
    - nm_hash_str() is our own string hashing implementation
    
    - nm_str_hash() is our own string implementation, but with a
      GHashFunc signature, suitable to pass it to g_hash_table_new().
      Also, it has this name in order to remind you of g_str_hash(),
      which it is replacing.
    0e9e35e3