From: navarrop Date: Thu, 23 Sep 2010 12:21:24 +0000 (+0000) Subject: Rename CLEANUP definition (used after TRY) into TRY_CLEANUP X-Git-Tag: v3_5~612 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a61b866b190b714478c1c53a5614008ae5ada205 Rename CLEANUP definition (used after TRY) into TRY_CLEANUP due to other definition of CLEANUP like src/xbt/graphxml.c:1201 "#define CLEANUP cleanup()" git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8212 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 85307628ea..76673411e0 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -140,7 +140,7 @@ __ex_mctx_struct} __ex_mctx_t; * * @section XBT_ex_base BASIC USAGE * - * \em TRY \b TRIED_BLOCK [\em _CLEANUP \b _CLEANUP_BLOCK] \em CATCH (variable) \b CATCH_BLOCK + * \em TRY \b TRIED_BLOCK [\em TRY_CLEANUP \b CLEANUP_BLOCK] \em CATCH (variable) \b CATCH_BLOCK * * This is the primary syntactical construct provided. It is modeled after the * ISO-C++ try-catch clause and should sound familiar to most of you. @@ -363,7 +363,7 @@ XBT_PUBLIC_DATA(ex_term_cb_t) __xbt_ex_terminate; /** @brief optional(!) block for cleanup * @hideinitializer */ -#define _CLEANUP \ +#define TRY_CLEANUP \ else { \ } \ __xbt_ex_ctx_ptr->ctx_caught = 0; \ diff --git a/src/ex_unit.c b/src/ex_unit.c index 9f8f51aaea..d291c97fe6 100644 --- a/src/ex_unit.c +++ b/src/ex_unit.c @@ -118,7 +118,7 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling") TRY { v1 = 5678; THROW0(1, 2, "blah"); - } _CLEANUP { + } TRY_CLEANUP { if (v1 != 5678) xbt_test_fail1("v1 = %d (!= 5678)", v1); c = 1; @@ -166,7 +166,7 @@ static void bad_example(void) cp3 = mallocex(SMALLAMOUNT); strcpy(cp1, "foo"); strcpy(cp2, "bar"); - } _CLEANUP { + } TRY_CLEANUP { if (cp3 != NULL) free(cp3); if (cp2 != NULL) @@ -203,7 +203,7 @@ static void good_example(void) cp3 = mallocex(SMALLAMOUNT); strcpy(cp1, "foo"); strcpy(cp2, "bar"); - } _CLEANUP { /*04 */ + } TRY_CLEANUP { /*04 */ printf("cp3=%s", cp3 == NULL /*02 */ ? "" : cp3); if (cp3 != NULL) free(cp3); diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index b61f7f8fb4..97d1a41645 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -388,7 +388,7 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst) TRY { size = gras_datadesc_memcpy_rec(state, refs, type, (char *) src, (char *) dst,0, type->cycle); - } _CLEANUP { + } TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); } CATCH(e) { @@ -625,7 +625,7 @@ void gras_datadesc_send(gras_socket_t sock, TRY { gras_datadesc_send_rec(sock, state, refs, type, (char *) src, type->cycle); - } _CLEANUP { + } TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); } CATCH(e) { @@ -960,7 +960,7 @@ gras_datadesc_recv(gras_socket_t sock, TRY { gras_datadesc_recv_rec(sock, state, refs, type, r_arch, NULL, 0, (char *) dst, -1, type->cycle); - } _CLEANUP { + } TRY_CLEANUP { xbt_dict_reset(refs); gras_cbps_reset(state); } CATCH(e) { diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c index f39e4e3a4d..1536b55e18 100644 --- a/src/xbt/dict_multi.c +++ b/src/xbt/dict_multi.c @@ -94,7 +94,7 @@ xbt_multidict_set(xbt_dict_t mdict, TRY { xbt_multidict_set_ext(mdict, keys, lens, data, free_ctn); - } _CLEANUP { + } TRY_CLEANUP { xbt_dynar_free(&lens); } CATCH(e) { RETHROW; @@ -229,7 +229,7 @@ void xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys) TRY { xbt_multidict_remove_ext(mdict, keys, lens); - } _CLEANUP { + } TRY_CLEANUP { xbt_dynar_free(&lens); } CATCH(e) { RETHROW; diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 450f7bab5f..9ba09f4afd 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -337,7 +337,7 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling") TRY { v1 = 5678; THROW0(1, 2, "blah"); - } _CLEANUP { + } TRY_CLEANUP { if (v1 != 5678) xbt_test_fail1("v1 = %d (!= 5678)", v1); c = 1; @@ -385,7 +385,7 @@ static void bad_example(void) cp3 = mallocex(SMALLAMOUNT); strcpy(cp1, "foo"); strcpy(cp2, "bar"); - } _CLEANUP { + } TRY_CLEANUP { if (cp3 != NULL) free(cp3); if (cp2 != NULL) @@ -422,7 +422,7 @@ static void good_example(void) cp3 = mallocex(SMALLAMOUNT); strcpy(cp1, "foo"); strcpy(cp2, "bar"); - } _CLEANUP { /*04 */ + } TRY_CLEANUP { /*04 */ printf("cp3=%s", cp3 == NULL /*02 */ ? "" : cp3); if (cp3 != NULL) free(cp3);