From 1005f2a4284dc2bd367dc5a4bf4609bc9ad06f94 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 9 Feb 2012 13:10:36 +0100 Subject: [PATCH] Mark multi-level dictionaries as deprecated. --- ChangeLog | 12 +++++++----- include/xbt/dict.h | 3 +++ src/xbt/dict.c | 5 +++++ src/xbt/dict_multi.c | 4 ++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7142fe1898..444c12f293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,11 +71,13 @@ SimGrid (3.7) NOT RELEASED; urgency=low XBT: * Mallocators: allow value NULL for the reset function. - * Dicts: new function xbt_dict_new_homogeneous(void(*)(void*)) to - 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. + * Dicts: + - New function xbt_dict_new_homogeneous(void(*)(void*)) to + create homogeneous dictionaries, where all the elements share the + same free function. Non homogeneous dictionaries will be + deprecated in the next release. + - Dicts of scalar elements (xbt_dicti_*) are deprecated. + - Multi-level dictionaries 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 05b34c8a2e..056dc8f795 100644 --- a/include/xbt/dict.h +++ b/include/xbt/dict.h @@ -147,6 +147,8 @@ XBT_PUBLIC(int) xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, xbt_dict_cursor_step(cursor) ) /** @} */ + +#ifdef XBT_USE_DEPRECATED /** @defgroup XBT_dict_multi Multi-level dictionaries * @ingroup XBT_dict * @@ -183,6 +185,7 @@ XBT_PUBLIC(void) xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t lens); /** @} */ +#endif SG_END_DECL() #endif /* _XBT_DICT_H */ diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 61a045a6f7..d97047947d 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -1236,14 +1236,17 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_dict_free(&head); } +#ifdef XBT_USE_DEPRECATED static void str_free(void *s) { char *c = *(char **) s; free(c); } +#endif XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test") { +#ifdef XBT_USE_DEPRECATED #undef NB_ELM #define NB_ELM 100 /*00 */ @@ -1311,5 +1314,7 @@ XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test") xbt_dict_free(&mdict); xbt_dynar_free(&keys); +#endif } + #endif /* SIMGRID_TEST */ diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c index 0c2e692526..a6f8887301 100644 --- a/src/xbt/dict_multi.c +++ b/src/xbt/dict_multi.c @@ -6,6 +6,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#ifdef XBT_USE_DEPRECATED + #include "dict_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_multi, xbt_dict, @@ -242,3 +244,5 @@ void xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys) RETHROW; } } + +#endif -- 2.20.1