Changeset 010a951 for functions.c


Ignore:
Timestamp:
Mar 5, 2011, 3:25:29 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
e3a75ed
Parents:
9620c8d
git-author:
David Benjamin <davidben@mit.edu> (02/28/11 10:53:18)
git-committer:
David Benjamin <davidben@mit.edu> (03/05/11 15:25:29)
Message:
Make owl_variable's get_tostring_fn return a newly allocated string

The mess with buffer lengths and whatnot is obnoxious. Note that this
does change semantics slightly: instead of (optionally) filling a buffer
and giving a return code for good vs no-variable/invalid, we now return
NULL for missing variables and always return a string if the variable
exists. This also appears to be more accurate from the perspective of
the calls anyway.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r3472845 r010a951  
    16161616{
    16171617  const char *name;
    1618   char var[LINE];
     1618  char *var;
    16191619  owl_list varnames;
    16201620  int i, numvarnames;
     
    16291629    if (name && name[0]!='_') {
    16301630      g_string_append_printf(str, "\n%-20s = ", name);
    1631       owl_variable_get_tostring(owl_global_get_vardict(&g), name, var, LINE);
    1632       g_string_append(str, var);
     1631      var = owl_variable_get_tostring(owl_global_get_vardict(&g), name);
     1632      if (var) {
     1633        g_string_append(str, var);
     1634        g_free(var);
     1635      }
    16331636    }
    16341637  }
Note: See TracChangeset for help on using the changeset viewer.