Changeset fa981f3 for variable.c


Ignore:
Timestamp:
Jul 3, 2011, 8:43:07 PM (10 years ago)
Author:
Jason Gross <jgross@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
785ee77
Parents:
1dab38e
git-author:
Jason Gross <jgross@mit.edu> (06/27/11 02:04:09)
git-committer:
Jason Gross <jgross@mit.edu> (07/03/11 20:43:07)
Message:
Removed some NULL checks for things that really shouldn't ever be NULL

If a BarnOwl variable can't be gotten, then something is horribly wrong,
and if it can't be gotten as a string, then perl will be confused (and
something is probably horribly wrong anyway).

Additionally, our variable descriptions shoud be descriptive.  Valid
settings should not be NULL (and NULL is more likely indicative of
forgetting to set it than actually wanting an empty valid set).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    r1dab38e rfa981f3  
    770770
    771771const char *owl_variable_get_validsettings(const owl_variable *v) {
    772   if (v->validsettings) {
    773     return v->validsettings;
    774   } else {
    775     return "";
    776   }
     772  return v->validsettings;
    777773}
    778774
     
    796792    return -1;
    797793  }
    798   if (msg && v->get_tostring_fn) {
     794  if (msg) {
    799795    tostring = v->get_tostring_fn(v, v->get_fn(v));
    800796    if (tostring)
     
    847843owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name)
    848844{
    849   owl_variable *v;
    850   if (!name) return(NULL);
    851   v = owl_dict_find_element(d, name);
    852   if (v == NULL || !v->get_fn) return NULL;
    853   return v;
     845  return owl_dict_find_element(d, name);
    854846}
    855847
Note: See TracChangeset for help on using the changeset viewer.