diff --git a/README.md b/README.md index 51f74be2..2c817bfc 100644 --- a/README.md +++ b/README.md @@ -2013,7 +2013,7 @@ This method is only defined for associative containers (no SET). Push the value referenced by key 'key' into the dictionary 'dict'. This method is only defined for SET. -##### void name\_remove(name\_t dict, const key\_type key) +##### void name\_erase(name\_t dict, const key\_type key) Remove the element referenced by key 'key' in the dictionary 'dict'. Do nothing if 'key' is no present in the dictionary. @@ -2745,7 +2745,7 @@ and save the popped value into 'dest' if the pointer is not null while keeping the tree balanced. Do nothing if 'data' is no present in the B+Tree. -##### bool name\_remove(name\_t tree, const key\_type data) +##### bool name\_erase(name\_t tree, const key\_type data) Remove 'data' from the B+Tree 'tree' while keeping the tree balanced. diff --git a/doc/API.txt b/doc/API.txt index b36d050a..eca4d3c7 100644 --- a/doc/API.txt +++ b/doc/API.txt @@ -27,4 +27,7 @@ V0.2.*: * worker_start takes a 'worker_t' as an additional parameter change name of _get_ ## field into _get_at_ ## fields Since there is a name collision with other methods if a field is named 'str'. + * Rename _remove into _erase for dictionary & B+TREE (adding a compatibility layer) for API uniformization. + The provided _remove doesn't use an iterator but a 'key', incompatible with the one of array or list. + But is like the one provided by the priority queue. diff --git a/doc/Container.ods b/doc/Container.ods index 0951ce97..42866e02 100644 Binary files a/doc/Container.ods and b/doc/Container.ods differ diff --git a/m-bptree.h b/m-bptree.h index 31d77330..b5678f29 100644 --- a/m-bptree.h +++ b/m-bptree.h @@ -663,7 +663,7 @@ return -1; /* unreachable */ \ } \ \ - static inline bool M_C(name, _remove)(tree_t b, key_t const key) \ + static inline bool M_C(name, _erase)(tree_t b, key_t const key) \ { \ BPTREEI_CONTRACT(N, key_oplist, b); \ pit_t pit; \ @@ -715,6 +715,12 @@ } \ } \ \ + static inline bool M_ATTR_DEPRECATED \ + M_C(name, _remove)(tree_t b, key_t const key) \ + { \ + return M_C(name, _erase)(b, key); \ + } \ + \ static inline bool M_C(name, _pop_at)(value_t *ptr, tree_t b, key_t const key) \ { \ if (ptr != NULL) { \ diff --git a/m-core.h b/m-core.h index ae8ea830..b61a10cc 100644 --- a/m-core.h +++ b/m-core.h @@ -85,6 +85,13 @@ # define M_ALIGN_FOR_CACHELINE_EXCLUSION 64 #endif +/* Deprecated attribute for function */ +#if defined(__GNUC__) && __GNUC__ >= 4 +#define M_ATTR_DEPRECATED __attribute__((deprecated)) +#else +#define M_ATTR_DEPRECATED +#endif + /***************************************************************/ /****************** Preprocessing Times Macro ******************/ /***************************************************************/ diff --git a/m-dict.h b/m-dict.h index fddd123d..97cdce82 100644 --- a/m-dict.h +++ b/m-dict.h @@ -457,7 +457,7 @@ } \ \ static inline bool \ - M_C(name, _remove)(dict_t map, key_type const key) \ + M_C(name, _erase)(dict_t map, key_type const key) \ { \ DICTI_CONTRACT(name, map); \ \ @@ -604,6 +604,12 @@ Do not used any fields of the dictionnary but the public API */ #define DICTI_FUNC_ADDITIONAL_DEF2(name, key_type, key_oplist, value_type, value_oplist, isSet, dict_t, dict_it_t) \ \ + static inline bool M_ATTR_DEPRECATED \ + M_C(name, _remove)(dict_t map, key_type const key) \ + { \ + return M_C(name, _erase)(map, key); \ + } \ + \ M_IF_METHOD_BOTH(GET_STR, key_oplist, value_oplist)( \ static inline void \ M_C(name, _get_str)(string_t str, const dict_t dict, const bool append) \ @@ -1271,7 +1277,7 @@ typedef enum { } \ \ static inline bool \ - M_C(name,_remove)(dict_t dict, const key_type key) \ + M_C(name,_erase)(dict_t dict, const key_type key) \ { \ DICTI_OA_CONTRACT(dict); \ /* NOTE: key can't be the representation of empty or deleted */ \