Changeset b75a8ac for variable.c


Ignore:
Timestamp:
Jun 27, 2011, 4:28:52 AM (13 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
554787e8
Parents:
0d935a1
git-author:
Jason Gross <jgross@mit.edu> (06/27/11 04:14:36)
git-committer:
Jason Gross <jgross@mit.edu> (06/27/11 04:28:52)
Message:
Make variable getters return NULL instead of "<null>"

This fixes trac-#184:
Since commit 010a9511420887329269aa51e7598533e826c57f, the default zsigs
show up as empty; BarnOwl::default_zephyr_signature() checks
BarnOwl::getvar('zsigproc') as a boolean (which may be incorrect if you
happen to have a zsigproc called 0). As of that commit, BarnOwl::getvar
returns "<null>" instead of undef.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    r0d935a1 rb75a8ac  
    940940{
    941941  if (val == NULL) {
    942     return g_strdup("<null>");
     942    return NULL;
    943943  } else if (*(const int*)val == 0) {
    944944    return g_strdup("off");
     
    976976{
    977977  if (val == NULL) {
    978     return g_strdup("<null>");
     978    return NULL;
    979979  } else {
    980980    return g_strdup_printf("%d", *(const int*)val);
     
    10201020
    10211021  if (val == NULL) {
    1022     return g_strdup("<null>");
     1022    return NULL;
    10231023  }
    10241024  enums = g_strsplit_set(v->validsettings, ",", 0);
     
    10561056CALLER_OWN char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
    10571057{
    1058   if (val == NULL) {
    1059     return g_strdup("<null>");
    1060   } else {
    1061     return g_strdup((const char*)val);
    1062   }
    1063 }
    1064 
     1058  return g_strdup((const char*)val);
     1059}
     1060
Note: See TracChangeset for help on using the changeset viewer.