From 194df46818e3f10278130de231015fb42a6b29f7 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 6 Aug 2014 22:04:35 +0200 Subject: [PATCH 1/1] useless cleanups - one letter variables are harder to read - remove a useless assert (the system will complain if it's null) - improve some debug messages and comments --- src/msg/msg_gos.c | 2 +- src/simix/smx_private.h | 8 ++++---- src/simix/smx_process.c | 4 +--- src/xbt/ex.c | 3 +-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index df8c0d3583..73c91df534 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -173,7 +173,7 @@ msg_error_t MSG_process_sleep(double nb_sec) // adsein: MSG_TASK_CANCELED is assigned when someone kills the process that made the sleep, this is not // correct. For instance, when the node is turned off, the error should be MSG_HOST_FAILURE, which is by the way // and according to the JAVA document, the only exception that can be triggered by MSG_Process_sleep call. - // To avoid possible impacts in the code, I just raised a host_failure execption for the moment in the JAVA code + // To avoid possible impacts in the code, I just raised a host_failure exception for the moment in the JAVA code // and did not change anythings at the C level. // See comment in the jmsg_process.c file, function JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cls, jlong jmillis, jint jnanos) status = MSG_TASK_CANCELED; diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index b2e5375f4a..34cf63e69a 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -71,11 +71,11 @@ XBT_PUBLIC(void) SIMIX_clean(void); #endif /******************************** Exceptions *********************************/ - -#define SMX_EXCEPTION(issuer, c, v, m) \ +/** @brief Ask to the provided simix process to raise the provided exception */ +#define SMX_EXCEPTION(issuer, cat, val, msg) \ if (1) { \ - smx_process_t _smx_throw_issuer = (issuer); \ - THROW_PREPARE(_smx_throw_issuer->running_ctx, (c), (v), xbt_strdup(m)); \ + smx_process_t _smx_throw_issuer = (issuer); /* evaluate only once */\ + THROW_PREPARE(_smx_throw_issuer->running_ctx, (cat), (val), xbt_strdup(msg)); \ _smx_throw_issuer->doexception = 1; \ } else ((void)0) diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 8d2320a51b..77578aef1b 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -494,8 +494,6 @@ void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process){ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) { - xbt_assert((process != NULL), "Invalid parameters"); - XBT_IN("process = %p, issuer = %p", process, issuer); if(process->context->iwannadie) { @@ -844,7 +842,7 @@ void SIMIX_process_yield(smx_process_t self) if (self->suspended) { XBT_DEBUG("Hey! I'm suspended."); - xbt_assert(!self->doexception, "Gloups! This exception may be lost by subsequent calls."); + xbt_assert(!self->doexception, "Gasp! This exception may be lost by subsequent calls."); self->suspended = 0; SIMIX_process_suspend(self, self); } diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 4b0d7bdf1c..8d4487cf33 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -177,8 +177,7 @@ void __xbt_ex_terminate_default(xbt_ex_t * e) /* the externally visible API */ XBT_EXPORT_NO_IMPORT(xbt_running_ctx_fetcher_t) __xbt_running_ctx_fetch = &__xbt_ex_ctx_default; -XBT_EXPORT_NO_IMPORT(ex_term_cb_t) __xbt_ex_terminate = - &__xbt_ex_terminate_default; +XBT_EXPORT_NO_IMPORT(ex_term_cb_t) __xbt_ex_terminate = &__xbt_ex_terminate_default; void xbt_ex_free(xbt_ex_t e) -- 2.20.1