-gras_error_t
-gras_cbps_v_push(gras_cbps_t *ps,
- const char *name,
- void *data,
- gras_datadesc_type_t *ddt) {
-
- gras_dynar_t *varstack,*frame;
- gras_cbps_elm_t *p_var;
- gras_error_t errcode;
- char *varname = (char*)strdup(name);
-
- DEBUG2("push(%s,%p)",name,(void*)data);
- errcode = gras_dict_get(ps->space, name, (void **)&varstack);
-
- if (errcode == mismatch_error) {
- DEBUG1("Create a new variable stack for '%s' into the space",name);
- varstack = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
- gras_dict_set(ps->space, varname, (void **)varstack, NULL);
- /* leaking, you think? only if you do not close all the openned blocks ;)*/
- } else if (errcode != no_error) {
- return errcode;
- }
-
- p_var = gras_new0(gras_cbps_elm_t,1);
- p_var->type = ddt;
- p_var->data = data;
-
- gras_dynar_push(varstack, &p_var);
-
- gras_dynar_pop(ps->frames, &frame);
- DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
- gras_dynar_push(frame, &varname);
- gras_dynar_push(ps->frames, &frame);
- return no_error;
+void
+gras_cbps_v_push(gras_cbps_t ps,
+ const char *name,
+ void *data,
+ gras_datadesc_type_t ddt) {
+
+ xbt_dynar_t varstack=NULL,frame;
+ gras_cbps_elm_t var;
+ char *varname = (char*)xbt_strdup(name);
+ xbt_ex_t e;
+
+ DEBUG2("push(%s,%p)",name,(void*)data);
+
+ TRY {
+ varstack = xbt_dict_get(ps->space, name);
+ } CATCH(e) {
+ if (e.category != mismatch_error)
+ RETHROW;
+
+ DEBUG1("Create a new variable stack for '%s' into the space",name);
+ varstack = xbt_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
+ xbt_dict_set(ps->space, varname, (void **)varstack, NULL);
+ xbt_ex_free(e);
+ /* leaking, you think? only if you do not close all the openned blocks ;)*/
+ }
+
+ var = xbt_new0(s_gras_cbps_elm_t,1);
+ var->type = ddt;
+ var->data = data;
+
+ xbt_dynar_push(varstack, &var);
+
+ xbt_dynar_pop(ps->frames, &frame);
+ DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
+ xbt_dynar_push(frame, &varname);
+ xbt_dynar_push(ps->frames, &frame);