From: Arnaud Giersch Date: Fri, 25 Nov 2011 22:23:49 +0000 (+0100) Subject: Mark integer dicts as deprecated. X-Git-Tag: exp_20120216~38 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a841dba0e3e34cff0ccd948667a339b4af9a4310?ds=sidebyside Mark integer dicts as deprecated. --- diff --git a/ChangeLog b/ChangeLog index bad8650cbb..7142fe1898 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,7 @@ SimGrid (3.7) NOT RELEASED; urgency=low create homogeneous dictionaries, where all the elements share the same free function. Non homogeneous dictionaries will be deprecated in the next release. + * Dicts: dicts of scalar elements (xbt_dicti_*) are deprecated. * mmalloc module: - cleanups and simplifications to make it maintainable again - exotic features (such as memalign and valloc) were removed diff --git a/include/xbt/dict.h b/include/xbt/dict.h index 5c6f6df546..10cf467b57 100644 --- a/include/xbt/dict.h +++ b/include/xbt/dict.h @@ -91,12 +91,12 @@ XBT_PUBLIC(void *) xbt_dict_get_or_null_ext(xbt_dict_t dict, XBT_PUBLIC(void) xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len); - +#ifdef XBT_USE_DEPRECATED XBT_PUBLIC(void) xbt_dicti_set(xbt_dict_t dict, uintptr_t key, uintptr_t data); XBT_PUBLIC(uintptr_t) xbt_dicti_get(xbt_dict_t dict, uintptr_t key); XBT_PUBLIC(void) xbt_dicti_remove(xbt_dict_t dict, uintptr_t key); - +#endif /** @} */ /** @defgroup XBT_dict_curs Cursors on dictionaries diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 04f969dce9..ed59711647 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -495,6 +495,7 @@ XBT_INLINE void xbt_dict_remove(xbt_dict_t dict, const char *key) xbt_dict_remove_ext(dict, key, strlen(key)); } +#ifdef XBT_USE_DEPRECATED /** * \brief Add data to the dict (arbitrary key) * \param dict the container @@ -529,7 +530,7 @@ XBT_INLINE void xbt_dicti_remove(xbt_dict_t dict, uintptr_t key) { xbt_dict_remove_ext(dict, (void *)&key, sizeof key); } - +#endif /** * \brief Remove all data from the dict @@ -1123,6 +1124,7 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management") xbt_dict_free(&head); } +#ifdef XBT_USE_DEPRECATED static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data) { uintptr_t stored_data = 0; @@ -1138,9 +1140,11 @@ static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data) "Retrieved data (%zu) is not what I just stored (%zu) under key %zu", stored_data, data, key); } +#endif XBT_TEST_UNIT("dicti", test_dict_scalar, "Scalar data and key management") { +#if XBT_USE_DEPRECATED xbt_test_add("Fill in the dictionnary"); head = xbt_dict_new(); @@ -1163,6 +1167,7 @@ XBT_TEST_UNIT("dicti", test_dict_scalar, "Scalar data and key management") debuged_addi(head, 0, 0); xbt_dict_free(&head); +#endif } #define NB_ELM 20000