Changeset ca749a9
- Timestamp:
- Jul 3, 2011, 8:43:06 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- b4a678a
- Parents:
- ca54fd6
- git-author:
- Jason Gross <jgross@mit.edu> (06/27/11 04:14:36)
- git-committer:
- Jason Gross <jgross@mit.edu> (07/03/11 20:43:06)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
rca54fd6 rca749a9 1655 1655 if (v) { 1656 1656 value = owl_variable_get_tostring(v); 1657 owl_function_makemsg("%s = '%s'", var, value); 1657 if (value == NULL) 1658 owl_function_makemsg("%s = <null>", var); 1659 else 1660 owl_function_makemsg("%s = '%s'", var, value); 1658 1661 g_free(value); 1659 1662 } else { -
functions.c
rca54fd6 rca749a9 1589 1589 var = owl_variable_get_tostring(v); 1590 1590 if (var) { 1591 g_string_append(str, var); 1592 g_free(var); 1591 g_string_append(str, var); 1592 g_free(var); 1593 } else { 1594 g_string_append(str, "<null>"); 1593 1595 } 1594 1596 } -
variable.c
rca54fd6 rca749a9 795 795 if (msg && v->get_tostring_fn) { 796 796 tostring = v->get_tostring_fn(v, v->get_fn(v)); 797 owl_function_makemsg("%s = '%s'", owl_variable_get_name(v), tostring); 797 if (tostring) 798 owl_function_makemsg("%s = '%s'", owl_variable_get_name(v), tostring); 799 else 800 owl_function_makemsg("%s = <null>", owl_variable_get_name(v)); 798 801 g_free(tostring); 799 802 } … … 897 900 void owl_variable_describe(const owl_variable *v, owl_fmtext *fm) 898 901 { 899 char *default_buf = owl_variable_get_default_tostring(v); 900 901 owl_fmtext_appendf_normal(fm, OWL_TABSTR "%-20s - %s (default: '%s')\n", 902 owl_variable_get_name(v), 903 owl_variable_get_summary(v), default_buf); 902 char *tostring = owl_variable_get_default_tostring(v); 903 char *default_buf; 904 905 if (tostring) 906 default_buf = g_strdup_printf("'%s'", tostring); 907 else 908 default_buf = g_strdup("<null>"); 909 owl_fmtext_appendf_normal(fm, OWL_TABSTR "%-20s - %s (default: %s)\n", 910 owl_variable_get_name(v), 911 owl_variable_get_summary(v), default_buf); 904 912 g_free(default_buf); 913 g_free(tostring); 905 914 } 906 915 … … 917 926 owl_fmtext_append_normal(fm, "Current: "); 918 927 tostring = owl_variable_get_tostring(v); 919 owl_fmtext_append_normal(fm, tostring);928 owl_fmtext_append_normal(fm, (tostring ? tostring : "<null>")); 920 929 g_free(tostring); 921 930 owl_fmtext_append_normal(fm, "\n\n"); … … 924 933 tostring = owl_variable_get_default_tostring(v); 925 934 owl_fmtext_append_normal(fm, "Default: "); 926 owl_fmtext_append_normal(fm, tostring);935 owl_fmtext_append_normal(fm, (tostring ? tostring : "<null>")); 927 936 owl_fmtext_append_normal(fm, "\n\n"); 928 937 … … 984 993 { 985 994 if (val == NULL) { 986 return g_strdup("<null>");995 return NULL; 987 996 } else if (*(const int*)val == 0) { 988 997 return g_strdup("off"); … … 1020 1029 { 1021 1030 if (val == NULL) { 1022 return g_strdup("<null>");1031 return NULL; 1023 1032 } else { 1024 1033 return g_strdup_printf("%d", *(const int*)val); … … 1064 1073 1065 1074 if (val == NULL) { 1066 return g_strdup("<null>");1075 return NULL; 1067 1076 } 1068 1077 enums = g_strsplit_set(v->validsettings, ",", 0); … … 1100 1109 CALLER_OWN char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) 1101 1110 { 1102 if (val == NULL) { 1103 return g_strdup("<null>"); 1104 } else { 1105 return g_strdup((const char*)val); 1106 } 1107 } 1108 1111 return g_strdup((const char*)val); 1112 } 1113
Note: See TracChangeset
for help on using the changeset viewer.