Changeset e428a36 for variable.c


Ignore:
Timestamp:
Jun 14, 2013, 7:39:41 PM (9 years ago)
Author:
David Benjamin <davidben@mit.edu>
Parents:
80c0fc7 (diff), 9d4dfdc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 9d4dfdcd2d49dbcc22eb7c50544376042b61a6ba into 80c0fc7442dbbcdb248b6b588246470d35b6f8ec
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    r6a8b519 r9d4dfdc  
    612612void owl_variable_dict_add_variable(owl_vardict * vardict,
    613613                                    owl_variable * var) {
     614  char *oldvalue = NULL;
     615  owl_variable *oldvar = owl_variable_get_var(vardict, var->name);
     616  /* Save the old value as a string. */
     617  if (oldvar) {
     618    oldvalue = owl_variable_get_tostring(oldvar);
     619  }
    614620  owl_dict_insert_element(vardict, var->name, var, (void (*)(void *))owl_variable_delete);
     621  /* Restore the old value. */
     622  if (oldvalue) {
     623    owl_variable_set_fromstring(var, oldvalue, 0);
     624    g_free(oldvalue);
     625  }
    615626}
    616627
     
    777788  g_free(v->default_str);
    778789  g_free(v->validsettings);
    779   g_value_unset(&(v->val));
     790  if (v->type != OWL_VARIABLE_OTHER)
     791    g_value_unset(&(v->val));
    780792  g_closure_unref(v->get_tostring_fn);
    781793  g_closure_unref(v->set_fromstring_fn);
Note: See TracChangeset for help on using the changeset viewer.