X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e566c09daba9ad67b31f3992da9172eb04b807a8..263e77cbb2185c86c9604558f0cd126873f51676:/src/xbt/ex.c diff --git a/src/xbt/ex.c b/src/xbt/ex.c index b2052e1c81..9768d5e640 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -98,7 +98,7 @@ void xbt_backtrace_display(xbt_ex_t * e) fprintf(stderr, "Backtrace (displayed in thread %p):\n", (void *) xbt_thread_self()); - for (i = 1; i < e->used; i++) /* no need to display "xbt_display_backtrace" */ + for (i = 1; i < e->used; i++) /* no need to display "xbt_backtrace_display" */ fprintf(stderr, "---> %s\n", e->bt_strings[i] + 4); } @@ -140,7 +140,7 @@ void xbt_ex_display(xbt_ex_t * e) "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n" "** %s\n" "** Thrown by %s()%s\n", - gras_os_myname(), (*xbt_getpid) (), + gras_os_myname(), xbt_getpid(), xbt_ex_catname(e->category), e->value, e->msg, e->procname, thrower ? thrower : " in this process"); XBT_CRITICAL("%s", e->msg); @@ -187,8 +187,7 @@ void xbt_ex_free(xbt_ex_t e) { int i; - if (e.msg) - free(e.msg); + free(e.msg); if (e.remote) { free(e.procname); free(e.file); @@ -198,8 +197,8 @@ void xbt_ex_free(xbt_ex_t e) if (e.bt_strings) { for (i = 0; i < e.used; i++) - free((char *) e.bt_strings[i]); - free((char **) e.bt_strings); + free(e.bt_strings[i]); + free(e.bt_strings); } /* memset(e,0,sizeof(xbt_ex_t)); */ } @@ -393,12 +392,9 @@ static void bad_example(void) strcpy(cp2, "bar"); } TRY_CLEANUP { - if (cp3 != NULL) - free(cp3); - if (cp2 != NULL) - free(cp2); - if (cp1 != NULL) - free(cp1); + free(cp3); + free(cp2); + free(cp1); } CATCH_ANONYMOUS { printf("cp3=%s", cp3); @@ -431,10 +427,8 @@ static void good_example(void) } TRY_CLEANUP { /*04 */ printf("cp3=%s", cp3 == NULL /*02 */ ? "" : cp3); - if (cp3 != NULL) - free(cp3); - if (cp2 != NULL) - free(cp2); + free(cp3); + free(cp2); /*05 cp1 was given away */ } CATCH_ANONYMOUS {