Changeset 55b2de8 for variable.c


Ignore:
Timestamp:
May 12, 2011, 4:39:26 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Children:
7fd0bf7
Parents:
13ee8f2
git-author:
David Benjamin <davidben@mit.edu> (05/07/11 15:12:09)
git-committer:
David Benjamin <davidben@mit.edu> (05/12/11 16:39:26)
Message:
Remove NULL checks before calling g_free

g_free handles the NULL check for us.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    rf203cad r55b2de8  
    641641
    642642void owl_variable_update(owl_variable *var, const char *summary, const char *desc) {
    643   if(var->summary) g_free(var->summary);
     643  g_free(var->summary);
    644644  var->summary = g_strdup(summary);
    645   if(var->description) g_free(var->description);
     645  g_free(var->description);
    646646  var->description = g_strdup(desc);
    647647}
     
    651651  if(old) {
    652652    owl_variable_update(old, summ, desc);
    653     if(old->pval_default) g_free(old->pval_default);
     653    g_free(old->pval_default);
    654654    old->pval_default = g_strdup(initval);
    655655  } else {
     
    944944void owl_variable_delete_default(owl_variable *v)
    945945{
    946   if (v->val) g_free(v->val);
     946  g_free(v->val);
    947947}
    948948
     
    10761076    if (!v->validate_fn(v, newval)) return(-1);
    10771077  }
    1078   if (v->val) g_free(v->val);
     1078  g_free(v->val);
    10791079  v->val = g_strdup(newval);
    10801080  return(0);
Note: See TracChangeset for help on using the changeset viewer.