Changeset ce68f23 for functions.c
- Timestamp:
- Jun 25, 2011, 3:26:16 AM (12 years ago)
- Branches:
- master, release-1.8, release-1.9
- Children:
- c266281
- Parents:
- 3cdd6d2
- git-author:
- David Benjamin <davidben@mit.edu> (06/11/11 20:06:46)
- git-committer:
- David Benjamin <davidben@mit.edu> (06/25/11 03:26:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r3cdd6d2 rce68f23 47 47 void owl_function_show_commands(void) 48 48 { 49 owl_listl;49 GPtrArray *l; 50 50 owl_fmtext fm; 51 51 … … 53 53 owl_fmtext_append_bold(&fm, "Commands: "); 54 54 owl_fmtext_append_normal(&fm, "(use 'show command <name>' for details)\n"); 55 owl_list_create(&l); 56 owl_cmddict_get_names(owl_global_get_cmddict(&g), &l); 57 owl_fmtext_append_list(&fm, &l, "\n", owl_function_cmd_describe); 55 l = owl_cmddict_get_names(owl_global_get_cmddict(&g)); 56 owl_fmtext_append_list(&fm, l, "\n", owl_function_cmd_describe); 58 57 owl_fmtext_append_normal(&fm, "\n"); 59 58 owl_function_popless_fmtext(&fm); 60 owl_ list_cleanup(&l, g_free);59 owl_ptr_array_free(l, g_free); 61 60 owl_fmtext_cleanup(&fm); 62 61 } … … 81 80 82 81 void owl_function_show_styles(void) { 83 owl_listl;82 GPtrArray *l; 84 83 owl_fmtext fm; 85 84 86 85 owl_fmtext_init_null(&fm); 87 86 owl_fmtext_append_bold(&fm, "Styles:\n"); 88 owl_list_create(&l); 89 owl_global_get_style_names(&g, &l); 90 owl_fmtext_append_list(&fm, &l, "\n", owl_function_style_describe); 87 l = owl_global_get_style_names(&g); 88 owl_fmtext_append_list(&fm, l, "\n", owl_function_style_describe); 91 89 owl_fmtext_append_normal(&fm, "\n"); 92 90 owl_function_popless_fmtext(&fm); 93 owl_ list_cleanup(&l, g_free);91 owl_ptr_array_free(l, g_free); 94 92 owl_fmtext_cleanup(&fm); 95 93 } … … 1576 1574 const char *name; 1577 1575 char *var; 1578 owl_listvarnames;1579 int i , numvarnames;1576 GPtrArray *varnames; 1577 int i; 1580 1578 GString *str = g_string_new(""); 1581 1579 1582 1580 g_string_append_printf(str, "%-20s = %s\n", "VARIABLE", "VALUE"); 1583 1581 g_string_append_printf(str, "%-20s %s\n", "--------", "-----"); 1584 owl_list_create(&varnames); 1585 owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames); 1586 numvarnames = owl_list_get_size(&varnames); 1587 for (i=0; i<numvarnames; i++) { 1588 name = owl_list_get_element(&varnames, i); 1582 varnames = owl_variable_dict_get_names(owl_global_get_vardict(&g)); 1583 for (i = 0; i < varnames->len; i++) { 1584 name = varnames->pdata[i]; 1589 1585 if (name && name[0]!='_') { 1590 1586 g_string_append_printf(str, "\n%-20s = ", name); … … 1597 1593 } 1598 1594 g_string_append(str, "\n"); 1599 owl_ list_cleanup(&varnames, g_free);1595 owl_ptr_array_free(varnames, g_free); 1600 1596 1601 1597 owl_function_popless_text(str->str); … … 1605 1601 void owl_function_show_variables(void) 1606 1602 { 1607 owl_listvarnames;1603 GPtrArray *varnames; 1608 1604 owl_fmtext fm; 1609 int i , numvarnames;1605 int i; 1610 1606 const char *varname; 1611 1607 … … 1613 1609 owl_fmtext_append_bold(&fm, 1614 1610 "Variables: (use 'show variable <name>' for details)\n"); 1615 owl_list_create(&varnames); 1616 owl_variable_dict_get_names(owl_global_get_vardict(&g), &varnames); 1617 numvarnames = owl_list_get_size(&varnames); 1618 for (i=0; i<numvarnames; i++) { 1619 varname = owl_list_get_element(&varnames, i); 1611 varnames = owl_variable_dict_get_names(owl_global_get_vardict(&g)); 1612 for (i = 0; i < varnames->len; i++) { 1613 varname = varnames->pdata[i]; 1620 1614 if (varname && varname[0]!='_') { 1621 1615 owl_variable_describe(owl_global_get_vardict(&g), varname, &fm); 1622 1616 } 1623 1617 } 1624 owl_ list_cleanup(&varnames, g_free);1618 owl_ptr_array_free(varnames, g_free); 1625 1619 owl_function_popless_fmtext(&fm); 1626 1620 owl_fmtext_cleanup(&fm); … … 2826 2820 void owl_function_show_keymaps(void) 2827 2821 { 2828 owl_listl;2822 GPtrArray *l; 2829 2823 owl_fmtext fm; 2830 2824 const owl_keymap *km; 2831 2825 const owl_keyhandler *kh; 2832 int i , numkm;2826 int i; 2833 2827 const char *kmname; 2834 2828 … … 2837 2831 owl_fmtext_append_bold(&fm, "Keymaps: "); 2838 2832 owl_fmtext_append_normal(&fm, "(use 'show keymap <name>' for details)\n"); 2839 owl_list_create(&l); 2840 owl_keyhandler_get_keymap_names(kh, &l); 2841 owl_fmtext_append_list(&fm, &l, "\n", owl_function_keymap_summary); 2833 l = owl_keyhandler_get_keymap_names(kh); 2834 owl_fmtext_append_list(&fm, l, "\n", owl_function_keymap_summary); 2842 2835 owl_fmtext_append_normal(&fm, "\n"); 2843 2836 2844 numkm = owl_list_get_size(&l); 2845 for (i=0; i<numkm; i++) { 2846 kmname = owl_list_get_element(&l, i); 2837 for (i = 0; i < l->len; i++) { 2838 kmname = l->pdata[i]; 2847 2839 km = owl_keyhandler_get_keymap(kh, kmname); 2848 2840 owl_fmtext_append_bold(&fm, "\n\n----------------------------------------------------------------------------------------------------\n\n"); … … 2852 2844 2853 2845 owl_function_popless_fmtext(&fm); 2854 owl_ list_cleanup(&l, g_free);2846 owl_ptr_array_free(l, g_free); 2855 2847 owl_fmtext_cleanup(&fm); 2856 2848 }
Note: See TracChangeset
for help on using the changeset viewer.