Added spec:commit task to commit changes to spec/ruby sources.
[rbx.git] / shotgun / lib / cleanup_hash.h
blob140d41148192a8d96b67820b1ffa32c0925f2bd2
1 #ifndef RBS_CLEANUP_HASH_H
2 #define RBS_CLEANUP_HASH_H
4 #include <hashtable.h>
5 #include "shotgun/lib/state.h"
6 #include "shotgun/lib/oop.h"
8 inline int ht_cleanup_insert(struct hashtable *h, OBJECT k, state_cleanup_func v)
10 return hashtable_insert(h, (void*)k, v);
12 inline state_cleanup_func ht_cleanup_search(const struct hashtable *h, const OBJECT k)
14 return (state_cleanup_func) hashtable_search(h,(void*)k);
17 inline state_cleanup_func ht_cleanup_remove(struct hashtable *h, OBJECT k)
19 return (state_cleanup_func) hashtable_remove(h,(void*)k);
22 inline unsigned int pointer_hash(const void * value)
24 return (unsigned int) (intptr_t) value;
27 inline int pointer_eq(const void * value1, const void * value2)
29 return value1 == value2;
32 inline struct hashtable * ht_cleanup_create(unsigned int minsize)
34 return create_hashtable(minsize, pointer_hash, pointer_eq);
37 inline void ht_cleanup_destroy(struct hashtable *ht_cleanup)
39 hashtable_destroy(ht_cleanup, FALSE);
42 #endif /* RBS_CLEANUP_HASH_H */