From 696369a34c85f78ffaa5aba69fde1e5446e5d8cb Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 13 Jun 2012 18:34:42 +0200 Subject: [PATCH 1/1] [trace] new function: PJ_value_get_or_new(). --- src/instr/instr_paje_values.c | 13 +++++++++++++ src/instr/instr_private.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/instr/instr_paje_values.c b/src/instr/instr_paje_values.c index 488468b204..b6f1e60d14 100644 --- a/src/instr/instr_paje_values.c +++ b/src/instr/instr_paje_values.c @@ -30,6 +30,19 @@ val_t PJ_value_new (const char *name, const char *color, type_t father) return ret; } +val_t PJ_value_get_or_new (const char *name, const char *color, type_t father) +{ + xbt_ex_t e; + TRY { + return PJ_value_get(name, father); + } + CATCH(e) { + xbt_ex_free(e); + return PJ_value_new(name, color, father); + } + THROW_IMPOSSIBLE; +} + val_t PJ_value_get (const char *name, type_t father) { if (name == NULL || father == NULL){ diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index 0bc4f9d2a8..49997e598a 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -224,6 +224,7 @@ void PJ_type_free_all (void); /* instr_paje_values.c */ val_t PJ_value_new (const char *name, const char *color, type_t father); +val_t PJ_value_get_or_new (const char *name, const char *color, type_t father); val_t PJ_value_get (const char *name, const type_t father); void PJ_value_free (val_t value); -- 2.20.1