]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
parser_const_string now uses hashtables; hashtables may want to dup an empty string...
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 297f73589dfdb9807831044837ebf623beab05f8..747aef4862ad7069d3a3500e6415661e457dac6a 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -300,7 +300,8 @@ void  util_meminfo       ();
 bool  util_filexists     (const char *);
 bool  util_strupper      (const char *);
 bool  util_strdigit      (const char *);
-char *_util_Estrdup        (const char *, const char *, size_t);
+char *_util_Estrdup      (const char *, const char *, size_t);
+char *_util_Estrdup_empty(const char *, const char *, size_t);
 void  util_debug         (const char *, const char *, ...);
 void  util_endianswap    (void *,  size_t, unsigned int);
 
@@ -329,6 +330,7 @@ int util_asprintf (char **ret, const char *fmt, ...);
 #endif /*! NOTRACK */
 
 #define util_strdup(X)  _util_Estrdup((X), __FILE__, __LINE__)
+#define util_strdupe(X) _util_Estrdup_empty((X), __FILE__, __LINE__)
 
 /*
  * A flexible vector implementation: all vector pointers contain some
@@ -336,7 +338,7 @@ int util_asprintf (char **ret, const char *fmt, ...);
  * this data is represented in the structure below.  Doing this allows
  * us to use the array [] to access individual elements from the vector
  * opposed to using set/get methods.
- */     
+ */
 typedef struct {
     size_t  allocated;
     size_t  used;
@@ -417,10 +419,13 @@ typedef struct hash_set_t {
  * util_htdel(foo);
  */
 hash_table_t *util_htnew (size_t size);
+void          util_htrem (hash_table_t *ht, void (*callback)(void *data));
 void          util_htset (hash_table_t *ht, const char *key, void *value);
 void          util_htdel (hash_table_t *ht);
 size_t        util_hthash(hash_table_t *ht, const char *key);
 void          util_htseth(hash_table_t *ht, const char *key, size_t hash, void *value);
+void          util_htrmh (hash_table_t *ht, const char *key, size_t bin, void (*cb)(void*));
+void          util_htrm  (hash_table_t *ht, const char *key, void (*cb)(void*));
 
 void         *util_htget (hash_table_t *ht, const char *key);
 void         *util_htgeth(hash_table_t *ht, const char *key, size_t hash);