declare __mg_map_find_replace_or_insert, mark __mg_map_find_or_insert and __mg_map_find_or_insert_ex as deprecated

This commit is contained in:
Vincent Wei
2020-03-02 14:37:59 +08:00
parent a6a9388fdf
commit 9fdfea572d
+27 -6
View File
@@ -67,6 +67,22 @@ typedef void *(*copy_val_fn) (const void *val);
typedef int (*comp_key_fn) (const void *key1, const void *key2);
typedef void (*free_val_fn) (void *val);
/* common functions for string key */
static inline void* copy_key_string (const void *key)
{
return strdup (key);
}
static inline void free_key_string (void *key)
{
free (key);
}
static inline int comp_key_string (const void *key1, const void *key2)
{
return strcmp (key1, key2);
}
typedef struct _map_t map_t;
typedef struct _map_entry_t {
struct rb_node node;
@@ -92,6 +108,16 @@ static inline int __mg_map_insert (map_t* map, const void* key,
return __mg_map_insert_ex (map, key, val, NULL);
}
int __mg_map_find_replace_or_insert (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
int __mg_map_replace (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
int __mg_map_erase (map_t* map, void* key);
int __mg_map_get_size (map_t* map);
#if 0 /* deprecated code */
void* __mg_map_find_or_insert_ex (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
@@ -100,12 +126,7 @@ static inline void* __mg_map_find_or_insert (map_t* map, const void* key,
{
return __mg_map_find_or_insert_ex (map, key, val, NULL);
}
int __mg_map_replace (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
int __mg_map_erase (map_t* map, void* key);
int __mg_map_get_size (map_t* map);
#endif /* deprecated code */
#ifdef __cplusplus
}