hashtable.h 961 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of the License "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description:
  15. *
  16. * A chained lookup hashtable implementation
  17. *
  18. */
  19. #ifndef _HASHTABLE_H_
  20. #define _HASHTABLE_H_
  21. #include "nodes.h"
  22. typedef Node1 HashNode;
  23. #include <ctype.h>
  24. typedef struct {
  25. size_t size;
  26. size_t free;
  27. Node1 **entries;
  28. } HashTable;
  29. HashTable *hashtable_new(size_t size);
  30. void hashtable_del(HashTable **h);
  31. size_t hashtable_gethash(const char *name);
  32. char *hashtable_lookup(HashTable *ht, const char *name);
  33. size_t hashtable_store(HashTable *ht, const char *key, const char *value);
  34. #endif