Changeset 81a5686
- Timestamp:
- Jun 19, 2011, 1:08:11 AM (13 years ago)
- Children:
- 4798b36
- Parents:
- 3756803
- git-author:
- Anders Kaseorg <andersk@mit.edu> (06/18/11 20:42:19)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (06/19/11 01:08:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
r3756803 r81a5686 7 7 8 8 #define OWLVAR_BOOL(name,default,summary,description) \ 9 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \9 { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \ 10 10 NULL, NULL, NULL, NULL, NULL, NULL } 11 11 12 12 #define OWLVAR_BOOL_FULL(name,default,summary,description,validate,set,get) \ 13 { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \13 { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \ 14 14 validate, set, NULL, get, NULL, NULL } 15 15 16 16 #define OWLVAR_INT(name,default,summary,description) \ 17 { name, OWL_VARIABLE_INT, NULL, default, "<int>", summary,description, NULL, \17 { g_strdup(name), OWL_VARIABLE_INT, NULL, default, "<int>", g_strdup(summary), g_strdup(description), NULL, \ 18 18 NULL, NULL, NULL, NULL, NULL, NULL } 19 19 20 20 #define OWLVAR_INT_FULL(name,default,summary,description,validset,validate,set,get) \ 21 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \21 { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \ 22 22 validate, set, NULL, get, NULL, NULL } 23 23 24 24 #define OWLVAR_PATH(name,default,summary,description) \ 25 { name, OWL_VARIABLE_STRING, default, 0, "<path>", summary,description, NULL, \25 { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<path>", g_strdup(summary), g_strdup(description), NULL, \ 26 26 NULL, NULL, NULL, NULL, NULL, NULL } 27 27 28 28 #define OWLVAR_STRING(name,default,summary,description) \ 29 { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \29 { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<string>", g_strdup(summary), g_strdup(description), NULL, \ 30 30 NULL, NULL, NULL, NULL, NULL, NULL } 31 31 32 32 #define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \ 33 { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \33 { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, validset, g_strdup(summary), g_strdup(description), NULL, \ 34 34 validate, set, NULL, get, NULL, NULL } 35 35 … … 38 38 * correspond to the values that may be specified. */ 39 39 #define OWLVAR_ENUM(name,default,summary,description,validset) \ 40 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \40 { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \ 41 41 owl_variable_enum_validate, \ 42 42 NULL, owl_variable_enum_set_fromstring, \ … … 45 45 46 46 #define OWLVAR_ENUM_FULL(name,default,summary,description,validset,validate, set, get) \ 47 { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \47 { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \ 48 48 validate, \ 49 49 set, owl_variable_enum_set_fromstring, \ … … 443 443 }; 444 444 445 return owl_variable_dict_add_from_list(vd, variables_to_init); 445 int ret = owl_variable_dict_add_from_list(vd, variables_to_init); 446 owl_variable *var; 447 for (var = variables_to_init; var->name != NULL; var++) 448 owl_variable_cleanup(var); 449 return ret; 446 450 } 447 451 … … 729 733 } 730 734 731 void owl_variable_ delete(owl_variable *v)735 void owl_variable_cleanup(owl_variable *v) 732 736 { 733 737 if (v->delete_fn) v->delete_fn(v); … … 737 741 if (v->type == OWL_VARIABLE_STRING) 738 742 g_free(v->pval_default); 743 } 744 745 void owl_variable_delete(owl_variable *v) 746 { 747 owl_variable_cleanup(v); 739 748 g_free(v); 740 749 }
Note: See TracChangeset
for help on using the changeset viewer.