puppylinux-woof-CE / gtkdialog

Script friendly gtk GUI builder
GNU General Public License v2.0
30 stars 18 forks source link

simplify file variables.c #128

Closed step- closed 2 years ago

step- commented 2 years ago

Function variables_is_avail_by_name is redundant so I decided to retire it because it obscures when malloc did take place. I didn't write new functions to replace it - I just reused existing functions consistently. variables_is_avail_by_name is retired in favor of two simpler idioms:

/* create */
var = variables_get_by_name(name); /* perform look-up */
if (var == NULL)
  var = variables_new(name); /* malloc */

/* use */
var = variables_get_by_name(name); /* perform look-up */
if (var != NULL) {
  /* use var */
}