Changeset f25df21 for functions.c


Ignore:
Timestamp:
Mar 24, 2011, 4:05:29 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
c809f5e
Parents:
e56303f
git-author:
David Benjamin <davidben@mit.edu> (03/08/11 15:04:52)
git-committer:
David Benjamin <davidben@mit.edu> (03/24/11 16:05:29)
Message:
Don't call owl_list_create in owl_dict_get_keys

Until we get rid of this owl_list thing altogether, there should be a
convention as to who initializes the thing. Otherwise, we leak memory
from people initializing it too many times.

Whoever reviews this probably wants to look over this very carefully in
case I missed one of the owl_list_creates.

Also kill the various wrappers over owl_list_cleanup as they are not the
inverse of any operation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r4479497 rf25df21  
    5353  owl_fmtext_append_bold(&fm, "Commands:  ");
    5454  owl_fmtext_append_normal(&fm, "(use 'show command <name>' for details)\n");
     55  owl_list_create(&l);
    5556  owl_cmddict_get_names(owl_global_get_cmddict(&g), &l);
    5657  owl_fmtext_append_list(&fm, &l, "\n", owl_function_cmd_describe);
    5758  owl_fmtext_append_normal(&fm, "\n");
    5859  owl_function_popless_fmtext(&fm);
    59   owl_cmddict_namelist_cleanup(&l);
     60  owl_list_cleanup(&l, g_free);
    6061  owl_fmtext_cleanup(&fm);
    6162}
     
    8586  owl_fmtext_init_null(&fm);
    8687  owl_fmtext_append_bold(&fm, "Styles:\n");
     88  owl_list_create(&l);
    8789  owl_global_get_style_names(&g, &l);
    8890  owl_fmtext_append_list(&fm, &l, "\n", owl_function_style_describe);
     
    16231625  g_string_append_printf(str, "%-20s = %s\n", "VARIABLE", "VALUE");
    16241626  g_string_append_printf(str, "%-20s   %s\n",  "--------", "-----");
     1627  owl_list_create(&varnames);
    16251628  owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames);
    16261629  numvarnames = owl_list_get_size(&varnames);
     
    16371640  }
    16381641  g_string_append(str, "\n");
    1639   owl_variable_dict_namelist_cleanup(&varnames);
     1642  owl_list_cleanup(&varnames, g_free);
    16401643
    16411644  owl_function_popless_text(str->str);
     
    16531656  owl_fmtext_append_bold(&fm,
    16541657      "Variables: (use 'show variable <name>' for details)\n");
     1658  owl_list_create(&varnames);
    16551659  owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames);
    16561660  numvarnames = owl_list_get_size(&varnames);
     
    16611665    }
    16621666  }
    1663   owl_variable_dict_namelist_cleanup(&varnames);
     1667  owl_list_cleanup(&varnames, g_free);
    16641668  owl_function_popless_fmtext(&fm);
    16651669  owl_fmtext_cleanup(&fm);
     
    28742878  owl_fmtext_append_bold(&fm, "Keymaps:   ");
    28752879  owl_fmtext_append_normal(&fm, "(use 'show keymap <name>' for details)\n");
     2880  owl_list_create(&l);
    28762881  owl_keyhandler_get_keymap_names(kh, &l);
    28772882  owl_fmtext_append_list(&fm, &l, "\n", owl_function_keymap_summary);
     
    28882893 
    28892894  owl_function_popless_fmtext(&fm);
    2890   owl_keyhandler_keymap_namelist_cleanup(&l);
     2895  owl_list_cleanup(&l, g_free);
    28912896  owl_fmtext_cleanup(&fm);
    28922897}
Note: See TracChangeset for help on using the changeset viewer.