API Compatibility change: rename _remove for DICT & B+TREE into _erase for API uniformization.

This commit is contained in:
Patrick Pelissier committed 2018-10-27 22:56:00 +02:00
1 parent 12bf9c0f59
commit 4e6dad939a
6 files changed
+27 -5

No files matched your search

+2 -2
View File
@@ -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.
+3
View File
@@ -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.
BIN
View File
Binary file not shown.
+7 -1
View File
@@ -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) { \
+7
View File
@@ -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 ******************/
/***************************************************************/
+8 -2
View File
@@ -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 */ \