Changeset 96828e4 for variable.c
- Timestamp:
- Feb 11, 2011, 4:31:33 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 35b6eb9
- Parents:
- 9518a85
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/27/09 00:51:45)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (02/11/11 16:31:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
rd275eb2 r96828e4 479 479 if (owl_dict_create(vd)) return(-1); 480 480 for (var = variables_to_init; var->name != NULL; var++) { 481 cur = owl_malloc(sizeof(owl_variable));481 cur = g_new(owl_variable, 1); 482 482 *cur = *var; 483 483 /* strdup all the strings so we can delete them consistently. */ … … 517 517 if (!cur->delete_fn) 518 518 cur->delete_fn = owl_variable_delete_default; 519 cur->val = owl_malloc(sizeof(int));519 cur->val = g_new(int, 1); 520 520 cur->set_fn(cur, &cur->ival_default); 521 521 break; … … 533 533 if (!cur->delete_fn) 534 534 cur->delete_fn = owl_variable_delete_default; 535 cur->val = owl_malloc(sizeof(int));535 cur->val = g_new(int, 1); 536 536 cur->set_fn(cur, &cur->ival_default); 537 537 break; … … 551 551 552 552 owl_variable * owl_variable_newvar(const char *name, const char *summary, const char * description) { 553 owl_variable * var = owl_malloc(sizeof(owl_variable)); 554 memset(var, 0, sizeof(owl_variable)); 553 owl_variable * var = g_new0(owl_variable, 1); 555 554 var->name = owl_strdup(name); 556 555 var->summary = owl_strdup(summary); … … 601 600 var->get_tostring_fn = owl_variable_int_get_tostring_default; 602 601 var->delete_fn = owl_variable_delete_default; 603 var->val = owl_malloc(sizeof(int));602 var->val = g_new(int, 1); 604 603 var->set_fn(var, &initval); 605 604 owl_variable_dict_add_variable(vd, var); … … 622 621 var->get_tostring_fn = owl_variable_bool_get_tostring_default; 623 622 var->delete_fn = owl_variable_delete_default; 624 var->val = owl_malloc(sizeof(int));623 var->val = g_new(int, 1); 625 624 var->set_fn(var, &initval); 626 625 owl_variable_dict_add_variable(vd, var);
Note: See TracChangeset
for help on using the changeset viewer.