Changeset d4927a7 for variable.c


Ignore:
Timestamp:
Feb 11, 2011, 4:31:46 PM (11 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
3472845
Parents:
ddbbcffa
git-author:
Anders Kaseorg <andersk@mit.edu> (08/27/09 00:55:10)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/11/11 16:31:46)
Message:
Replace owl_strdup with g_strdup.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Karl Ramm <kcr@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    rddbbcffa rd4927a7  
    482482    *cur = *var;
    483483    /* strdup all the strings so we can delete them consistently. */
    484     cur->name = owl_strdup(var->name);
    485     cur->summary = owl_strdup(var->summary);
    486     cur->description = owl_strdup(var->description);
     484    cur->name = g_strdup(var->name);
     485    cur->summary = g_strdup(var->summary);
     486    cur->description = g_strdup(var->description);
    487487    switch (cur->type) {
    488488    case OWL_VARIABLE_OTHER:
     
    552552owl_variable * owl_variable_newvar(const char *name, const char *summary, const char * description) {
    553553  owl_variable * var = g_new0(owl_variable, 1);
    554   var->name = owl_strdup(name);
    555   var->summary = owl_strdup(summary);
    556   var->description = owl_strdup(description);
     554  var->name = g_strdup(name);
     555  var->summary = g_strdup(summary);
     556  var->description = g_strdup(description);
    557557  return var;
    558558}
     
    560560void owl_variable_update(owl_variable *var, const char *summary, const char *desc) {
    561561  if(var->summary) g_free(var->summary);
    562   var->summary = owl_strdup(summary);
     562  var->summary = g_strdup(summary);
    563563  if(var->description) g_free(var->description);
    564   var->description = owl_strdup(desc);
     564  var->description = g_strdup(desc);
    565565}
    566566
     
    570570    owl_variable_update(old, summ, desc);
    571571    if(old->pval_default) g_free(old->pval_default);
    572     old->pval_default = owl_strdup(initval);
     572    old->pval_default = g_strdup(initval);
    573573  } else {
    574574    owl_variable * var = owl_variable_newvar(name, summ, desc);
    575575    var->type = OWL_VARIABLE_STRING;
    576     var->pval_default = owl_strdup(initval);
     576    var->pval_default = g_strdup(initval);
    577577    var->set_fn = owl_variable_string_set_default;
    578578    var->set_fromstring_fn = owl_variable_string_set_fromstring_default;
     
    10091009  }
    10101010  if (v->val) g_free(v->val);
    1011   v->val = owl_strdup(newval);
     1011  v->val = g_strdup(newval);
    10121012  return(0);
    10131013}
Note: See TracChangeset for help on using the changeset viewer.