Changeset d427f08
- Timestamp:
- Jun 22, 2011, 3:40:50 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- b343c2c
- Parents:
- 84a071f
- git-author:
- Jason Gross <jgross@mit.edu> (06/06/11 05:24:30)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (06/22/11 15:40:50)
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
aim.c
r6b0b4f4 rd427f08 437 437 438 438 /* caller must free the return */ 439 char *owl_aim_normalize_screenname(const char *in)439 G_GNUC_WARN_UNUSED_RESULT char *owl_aim_normalize_screenname(const char *in) 440 440 { 441 441 char *out; -
cmd.c
raad166a rd427f08 9 9 /**************************************************************************/ 10 10 11 int owl_cmddict_setup(owl_cmddict *cd) { 11 void owl_cmddict_setup(owl_cmddict *cd) 12 { 12 13 owl_cmddict_init(cd); 13 returnowl_cmd_add_defaults(cd);14 owl_cmd_add_defaults(cd); 14 15 } 15 16 … … 19 20 20 21 /* for bulk initialization at startup */ 21 int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) { 22 void owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) 23 { 22 24 const owl_cmd *cur; 23 int ret = 0;24 25 for (cur = cmds; cur->name != NULL; cur++) { 25 ret = owl_cmddict_add_cmd(cd, cur); 26 if (ret < 0) break; 27 } 28 return ret; 26 owl_cmddict_add_cmd(cd, cur); 27 } 29 28 } 30 29 … … 38 37 39 38 /* creates a new command alias */ 40 intowl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {39 void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) { 41 40 owl_cmd *cmd; 42 41 cmd = g_new(owl_cmd, 1); … … 44 43 owl_perlconfig_new_command(cmd->name); 45 44 owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete); 46 return(0);47 45 } 48 46 … … 57 55 } 58 56 59 char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) { 57 /* caller must free the return */ 58 G_GNUC_WARN_UNUSED_RESULT char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) 59 { 60 60 char *retval = NULL; 61 61 const owl_cmd *cmd; … … 72 72 } 73 73 74 char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) { 74 /* caller must free the return */ 75 G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) 76 { 75 77 char **argv; 76 78 int argc; … … 94 96 } 95 97 96 char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) { 98 /* caller must free the return */ 99 G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) 100 { 97 101 char *buff; 98 102 char *retval = NULL; … … 121 125 } 122 126 123 intowl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {127 void owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) { 124 128 memset(cmd, 0, sizeof(owl_cmd)); 125 129 cmd->name = g_strdup(name); 126 130 cmd->cmd_aliased_to = g_strdup(aliased_to); 127 131 cmd->summary = g_strdup_printf("%s%s", OWL_CMD_ALIAS_SUMMARY_PREFIX, aliased_to); 128 return(0);129 132 } 130 133 … … 150 153 } 151 154 152 char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) { 155 /* caller must free the result */ 156 G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) 157 { 153 158 static int alias_recurse_depth = 0; 154 159 int ival=0; … … 223 228 224 229 /* returns a summary line describing this keymap. the caller must free. */ 225 char *owl_cmd_describe(const owl_cmd *cmd) { 230 G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_describe(const owl_cmd *cmd) 231 { 226 232 if (!cmd || !cmd->name || !cmd->summary) return NULL; 227 233 return g_strdup_printf("%-25s - %s", cmd->name, cmd->summary); -
commands.c
r58f4fb2 rd427f08 41 41 42 42 43 intowl_cmd_add_defaults(owl_cmddict *cd)43 void owl_cmd_add_defaults(owl_cmddict *cd) 44 44 { 45 45 owl_cmd commands_to_init[] = { … … 1040 1040 }; 1041 1041 1042 int ret =owl_cmddict_add_from_list(cd, commands_to_init);1042 owl_cmddict_add_from_list(cd, commands_to_init); 1043 1043 owl_cmd *cmd; 1044 1044 for (cmd = commands_to_init; cmd->name != NULL; cmd++) 1045 1045 owl_cmd_cleanup(cmd); 1046 return ret;1047 1046 } 1048 1047 … … 1374 1373 } 1375 1374 1376 char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)1375 G_GNUC_WARN_UNUSED_RESULT char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) 1377 1376 { 1378 1377 char *filtname = NULL; … … 1414 1413 } 1415 1414 1416 char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)1415 G_GNUC_WARN_UNUSED_RESULT char *owl_command_get_shift(int argc, const char *const *argv, const char *buff) 1417 1416 { 1418 1417 if(argc != 1) … … 1645 1644 1646 1645 1647 char *owl_command_exec(int argc, const char *const *argv, const char *buff)1646 G_GNUC_WARN_UNUSED_RESULT char *owl_command_exec(int argc, const char *const *argv, const char *buff) 1648 1647 { 1649 1648 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN); 1650 1649 } 1651 1650 1652 char *owl_command_pexec(int argc, const char *const *argv, const char *buff)1651 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pexec(int argc, const char *const *argv, const char *buff) 1653 1652 { 1654 1653 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP); 1655 1654 } 1656 1655 1657 char *owl_command_aexec(int argc, const char *const *argv, const char *buff)1656 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aexec(int argc, const char *const *argv, const char *buff) 1658 1657 { 1659 1658 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1660 1659 } 1661 1660 1662 char *owl_command_perl(int argc, const char *const *argv, const char *buff)1661 G_GNUC_WARN_UNUSED_RESULT char *owl_command_perl(int argc, const char *const *argv, const char *buff) 1663 1662 { 1664 1663 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN); 1665 1664 } 1666 1665 1667 char *owl_command_pperl(int argc, const char *const *argv, const char *buff)1666 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pperl(int argc, const char *const *argv, const char *buff) 1668 1667 { 1669 1668 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP); 1670 1669 } 1671 1670 1672 char *owl_command_aperl(int argc, const char *const *argv, const char *buff)1671 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aperl(int argc, const char *const *argv, const char *buff) 1673 1672 { 1674 1673 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1675 1674 } 1676 1675 1677 char *owl_command_multi(int argc, const char *const *argv, const char *buff)1676 G_GNUC_WARN_UNUSED_RESULT char *owl_command_multi(int argc, const char *const *argv, const char *buff) 1678 1677 { 1679 1678 char *lastrv = NULL, *newbuff; … … 2595 2594 } 2596 2595 2597 char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)2596 G_GNUC_WARN_UNUSED_RESULT char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) 2598 2597 { 2599 2598 const char *stylename; … … 2639 2638 } 2640 2639 2641 char *owl_command_with_history(int argc, const char *const *argv, const char *buff)2640 G_GNUC_WARN_UNUSED_RESULT char *owl_command_with_history(int argc, const char *const *argv, const char *buff) 2642 2641 { 2643 2642 owl_history *hist; -
context.c
rd4927a7 rd427f08 6 6 7 7 /* TODO: dependency from owl_context -> owl_window is annoying. */ 8 owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)8 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor) 9 9 { 10 10 owl_context *c; -
dict.c
r4c7c21f rd427f08 107 107 /* Doesn't free the value of the element, but does 108 108 * return it so the caller can free it. */ 109 void *owl_dict_remove_element(owl_dict *d, const char *k) { 109 G_GNUC_WARN_UNUSED_RESULT void *owl_dict_remove_element(owl_dict *d, const char *k) 110 { 110 111 int i; 111 112 int pos, found; -
editcontext.c
r4a41f16 rd427f08 8 8 } 9 9 10 owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)10 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata) 11 11 { 12 12 owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap, -
editwin.c
r3b8a563 rd427f08 61 61 static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len); 62 62 static int oe_copy_region(owl_editwin *e); 63 static char *oe_chunk(owl_editwin *e, int start, int end);63 static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end); 64 64 static void oe_destroy_cbdata(owl_editwin *e); 65 65 static void oe_dirty(owl_editwin *e); … … 70 70 #define WHITESPACE " \n\t" 71 71 72 static owl_editwin *owl_editwin_allocate(void)72 static G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_allocate(void) 73 73 { 74 74 owl_editwin *e = g_new0(owl_editwin, 1); … … 142 142 } 143 143 144 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)144 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist) 145 145 { 146 146 owl_editwin *e = owl_editwin_allocate(); … … 1369 1369 } 1370 1370 1371 char *owl_editwin_get_region(owl_editwin *e)1371 G_GNUC_WARN_UNUSED_RESULT char *owl_editwin_get_region(owl_editwin *e) 1372 1372 { 1373 1373 int start, end; … … 1388 1388 } 1389 1389 1390 static char *oe_chunk(owl_editwin *e, int start, int end)1390 static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end) 1391 1391 { 1392 1392 char *p; -
filter.c
re56303f rd427f08 200 200 201 201 202 char *owl_filter_print(const owl_filter *f)202 char G_GNUC_WARN_UNUSED_RESULT *owl_filter_print(const owl_filter *f) 203 203 { 204 204 GString *out = g_string_new(""); -
fmtext.c
r7b4f3be rd427f08 171 171 * freeing the return 172 172 */ 173 char *owl_fmtext_print_plain(const owl_fmtext *f)173 char G_GNUC_WARN_UNUSED_RESULT *owl_fmtext_print_plain(const owl_fmtext *f) 174 174 { 175 175 return owl_strip_format_chars(f->buff->str); -
functions.c
r58f4fb2 rd427f08 14 14 #include "filterproc.h" 15 15 16 char *owl_function_command(const char *cmdbuff)16 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command(const char *cmdbuff) 17 17 { 18 18 owl_function_debugmsg("executing command: %s", cmdbuff); … … 21 21 } 22 22 23 char *owl_function_command_argv(const char *const *argv, int argc)23 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command_argv(const char *const *argv, int argc) 24 24 { 25 25 return owl_cmddict_execute_argv(owl_global_get_cmddict(&g), … … 95 95 } 96 96 97 char *owl_function_style_describe(const char *name) { 97 G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name) 98 { 98 99 const char *desc; 99 100 char *s; … … 111 112 } 112 113 113 char *owl_function_cmd_describe(const char *name)114 G_GNUC_WARN_UNUSED_RESULT char *owl_function_cmd_describe(const char *name) 114 115 { 115 116 const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 249 250 * owl_global_messagequeue_addmsg() for that. 250 251 */ 251 owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)252 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char *body, const char *to) 252 253 { 253 254 owl_message *m; … … 270 271 * owl_global_messagequeue_addmsg() for that. 271 272 */ 272 owl_message *owl_function_make_outgoing_loopback(const char *body)273 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_loopback(const char *body) 273 274 { 274 275 owl_message *m; … … 1899 1900 } 1900 1901 1901 owl_editwin *owl_function_start_question(const char *line)1902 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *line) 1902 1903 { 1903 1904 owl_editwin *tw; … … 1914 1915 } 1915 1916 1916 owl_editwin *owl_function_start_password(const char *line)1917 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *line) 1917 1918 { 1918 1919 owl_editwin *tw; … … 1931 1932 } 1932 1933 1933 char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)1934 G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type) 1934 1935 { 1935 1936 /* if type == 1 display in a popup … … 1974 1975 } 1975 1976 1976 char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)1977 G_GNUC_WARN_UNUSED_RESULT char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type) 1977 1978 { 1978 1979 /* if type == 1 display in a popup … … 2144 2145 * Returns the name of the negated filter, which the caller must free. 2145 2146 */ 2146 char *owl_function_create_negative_filter(const char *filtername)2147 G_GNUC_WARN_UNUSED_RESULT char *owl_function_create_negative_filter(const char *filtername) 2147 2148 { 2148 2149 char *newname; … … 2241 2242 * If 'related' is nonzero, encompass unclasses and .d classes as well. 2242 2243 */ 2243 char *owl_function_classinstfilt(const char *c, const char *i, int related)2244 G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const char *i, int related) 2244 2245 { 2245 2246 owl_filter *f; … … 2328 2329 * the filter, which the caller must free. 2329 2330 */ 2330 char *owl_function_zuserfilt(const char *longuser)2331 G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser) 2331 2332 { 2332 2333 owl_filter *f; … … 2374 2375 * Returns the name of the filter, which the caller must free. 2375 2376 */ 2376 char *owl_function_aimuserfilt(const char *user)2377 G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user) 2377 2378 { 2378 2379 owl_filter *f; … … 2412 2413 } 2413 2414 2414 char *owl_function_typefilt(const char *type)2415 G_GNUC_WARN_UNUSED_RESULT char *owl_function_typefilt(const char *type) 2415 2416 { 2416 2417 owl_filter *f; … … 2468 2469 } 2469 2470 2470 static char *owl_function_smartfilter_cc(const owl_message *m) { 2471 static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m) 2472 { 2471 2473 const char *ccs; 2472 2474 char *ccs_quoted; … … 2519 2521 * name to the AIM conversation with that user 2520 2522 */ 2521 char *owl_function_smartfilter(int type, int invert_related)2523 G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter(int type, int invert_related) 2522 2524 { 2523 2525 const owl_view *v; … … 2858 2860 } 2859 2861 2860 char *owl_function_keymap_summary(const char *name)2862 G_GNUC_WARN_UNUSED_RESULT char *owl_function_keymap_summary(const char *name) 2861 2863 { 2862 2864 const owl_keymap *km … … 2972 2974 /* strips formatting from ztext and returns the unformatted text. 2973 2975 * caller is responsible for freeing. */ 2974 char *owl_function_ztext_stylestrip(const char *zt)2976 G_GNUC_WARN_UNUSED_RESULT char *owl_function_ztext_stylestrip(const char *zt) 2975 2977 { 2976 2978 owl_fmtext fm; -
global.c
raa69c1e rd427f08 173 173 /* Pops the current context from the context stack and returns it. Caller is 174 174 * responsible for freeing. */ 175 owl_context *owl_global_pop_context_no_delete(owl_global *g) { 175 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_global_pop_context_no_delete(owl_global *g) 176 { 176 177 owl_context *c; 177 178 if (!g->context_stack) … … 725 726 * necessary. 726 727 */ 727 owl_message *owl_global_messagequeue_popmsg(owl_global *g)728 owl_message G_GNUC_WARN_UNUSED_RESULT *owl_global_messagequeue_popmsg(owl_global *g) 728 729 { 729 730 owl_message *out; -
keybinding.c
r3b8a563 rd427f08 14 14 15 15 /* sets up a new keybinding for a command */ 16 owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)16 G_GNUC_WARN_UNUSED_RESULT owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) 17 17 { 18 18 owl_keybinding *kb = g_new(owl_keybinding, 1); … … 85 85 } 86 86 87 char *owl_keybinding_stack_tostring(int *j, int len)87 G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_stack_tostring(int *j, int len) 88 88 { 89 89 GString *string; … … 100 100 } 101 101 102 char *owl_keybinding_tostring(const owl_keybinding *kb)102 G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_tostring(const owl_keybinding *kb) 103 103 { 104 104 return owl_keybinding_stack_tostring(kb->keys, kb->len); -
keymap.c
r4c7c21f rd427f08 51 51 } 52 52 } 53 return owl_list_append_element(&km->bindings, kb);54 53 owl_list_append_element(&km->bindings, kb); 54 return 0; 55 55 } 56 56 … … 80 80 81 81 /* returns a summary line describing this keymap. the caller must free. */ 82 char *owl_keymap_summary(const owl_keymap *km)82 G_GNUC_WARN_UNUSED_RESULT char *owl_keymap_summary(const owl_keymap *km) 83 83 { 84 84 if (!km || !km->name || !km->desc) return NULL; -
keypress.c
rd07af84 rd427f08 129 129 /* OWL_META is definied in owl.h */ 130 130 131 char *owl_keypress_tostring(int j, int esc)131 char G_GNUC_WARN_UNUSED_RESULT *owl_keypress_tostring(int j, int esc) 132 132 { 133 133 GString *kb; -
list.c
rfda61d3 rd427f08 53 53 } 54 54 55 intowl_list_append_element(owl_list *l, void *element)55 void owl_list_append_element(owl_list *l, void *element) 56 56 { 57 returnowl_list_insert_element(l, l->size, element);57 owl_list_insert_element(l, l->size, element); 58 58 } 59 59 60 intowl_list_prepend_element(owl_list *l, void *element)60 void owl_list_prepend_element(owl_list *l, void *element) 61 61 { 62 returnowl_list_insert_element(l, 0, element);62 owl_list_insert_element(l, 0, element); 63 63 } 64 64 -
logging.c
rcc305b5 rd427f08 80 80 } 81 81 82 char *owl_log_zephyr(const owl_message *m) { 82 G_GNUC_WARN_UNUSED_RESULT char *owl_log_zephyr(const owl_message *m) 83 { 83 84 char *tmp = NULL; 84 85 GString *buffer = NULL; … … 103 104 } 104 105 105 char *owl_log_aim(const owl_message *m) { 106 G_GNUC_WARN_UNUSED_RESULT char *owl_log_aim(const owl_message *m) 107 { 106 108 GString *buffer = NULL; 107 109 buffer = g_string_new(""); … … 120 122 } 121 123 122 char *owl_log_jabber(const owl_message *m) { 124 G_GNUC_WARN_UNUSED_RESULT char *owl_log_jabber(const owl_message *m) 125 { 123 126 GString *buffer = NULL; 124 127 buffer = g_string_new(""); … … 132 135 } 133 136 134 char *owl_log_generic(const owl_message *m) { 137 G_GNUC_WARN_UNUSED_RESULT char *owl_log_generic(const owl_message *m) 138 { 135 139 GString *buffer; 136 140 buffer = g_string_new(""); -
message.c
r259e60a8 rd427f08 580 580 581 581 /* caller must free return value. */ 582 char *owl_message_get_cc(const owl_message *m)582 G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m) 583 583 { 584 584 const char *cur; … … 597 597 598 598 /* caller must free return value */ 599 G List *owl_message_get_cc_without_recipient(const owl_message *m)599 G_GNUC_WARN_UNUSED_RESULT GList *owl_message_get_cc_without_recipient(const owl_message *m) 600 600 { 601 601 char *cc, *shortuser, *recip; -
messagelist.c
r66a8cd6 rd427f08 42 42 } 43 43 44 intowl_messagelist_append_element(owl_messagelist *ml, void *element)44 void owl_messagelist_append_element(owl_messagelist *ml, void *element) 45 45 { 46 return(owl_list_append_element(&(ml->list), element));46 owl_list_append_element(&ml->list, element); 47 47 } 48 48 -
owl.h
raa69c1e rd427f08 251 251 * WARNING: this approach is hard to make 252 252 * thread-safe... */ 253 char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);253 char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val); 254 254 /* converts val to a string; 255 255 * caller must free the result */ … … 313 313 314 314 /* These don't take any context */ 315 char *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);315 char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff); 316 316 /* takes argv and the full command as buff. 317 317 * caller must free return value if !NULL */ … … 320 320 321 321 /* The following also take the active context if it's valid */ 322 char *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);322 char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff); 323 323 /* takes argv and the full command as buff. 324 324 * caller must free return value if !NULL */ -
perlconfig.c
rbcde7926 rd427f08 23 23 24 24 25 SV *owl_new_sv(const char * str)25 G_GNUC_WARN_UNUSED_RESULT SV *owl_new_sv(const char * str) 26 26 { 27 27 SV *ret = newSVpv(str, 0); … … 36 36 } 37 37 38 AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))38 G_GNUC_WARN_UNUSED_RESULT AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *)) 39 39 { 40 40 AV *ret; … … 52 52 } 53 53 54 HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))54 G_GNUC_WARN_UNUSED_RESULT HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *)) 55 55 { 56 56 HV *ret; … … 75 75 } 76 76 77 SV *owl_perlconfig_message2hashref(const owl_message *m)77 G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_message2hashref(const owl_message *m) 78 78 { 79 79 HV *h, *stash; … … 165 165 } 166 166 167 SV *owl_perlconfig_curmessage2hashref(void)167 G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_curmessage2hashref(void) 168 168 { 169 169 int curmsg; … … 183 183 This has been somewhat addressed, but is still not lossless. 184 184 */ 185 owl_message *owl_perlconfig_hashref2message(SV *msg)185 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_perlconfig_hashref2message(SV *msg) 186 186 { 187 187 owl_message * m; … … 251 251 /* Calls in a scalar context, passing it a hash reference. 252 252 If return value is non-null, caller must free. */ 253 char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)253 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m) 254 254 { 255 255 dSP ; … … 300 300 If the return value is non-null, the caller must free it. 301 301 */ 302 char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)302 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv) 303 303 { 304 304 dSP; … … 349 349 } 350 350 351 352 char *owl_perlconfig_initperl(const char * file, int *Pargc, char ***Pargv, char ***Penv)351 /* caller must free result, if not NULL */ 352 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv) 353 353 { 354 354 int ret; … … 436 436 437 437 /* caller is responsible for freeing returned string */ 438 char *owl_perlconfig_execute(const char *line)438 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line) 439 439 { 440 440 STRLEN len; … … 505 505 } 506 506 507 char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 507 /* caller must free the result */ 508 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 508 509 { 509 510 int i, count; -
popwin.c
rddbbcffa rd427f08 1 1 #include "owl.h" 2 2 3 owl_popwin *owl_popwin_new(void)3 G_GNUC_WARN_UNUSED_RESULT owl_popwin *owl_popwin_new(void) 4 4 { 5 5 owl_popwin *pw = g_new0(owl_popwin, 1); -
regex.c
rd4927a7 rd427f08 39 39 { 40 40 char *quoted; 41 int ret; 41 42 42 quoted =owl_text_quote(string, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);43 owl_regex_create(re, quoted);43 quoted = owl_text_quote(string, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH); 44 ret = owl_regex_create(re, quoted); 44 45 g_free(quoted); 45 return (0);46 return ret; 46 47 } 47 48 -
text.c
r7865479 rd427f08 7 7 /* Returns a copy of 'in' with each line indented 'n' 8 8 * characters. Result must be freed with g_free. */ 9 char *owl_text_indent(const char *in, int n)9 G_GNUC_WARN_UNUSED_RESULT char *owl_text_indent(const char *in, int n) 10 10 { 11 11 const char *ptr1, *ptr2, *last; … … 48 48 49 49 /* caller must free the return */ 50 char *owl_text_htmlstrip(const char *in)50 G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in) 51 51 { 52 52 const char *ptr1, *end, *ptr2, *ptr3; … … 129 129 130 130 /* Caller must free return */ 131 char *owl_text_expand_tabs(const char *in)131 G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in) 132 132 { 133 133 int len = 0; … … 188 188 189 189 /* caller must free the return */ 190 char *owl_text_wordwrap(const char *in, int col)190 G_GNUC_WARN_UNUSED_RESULT char *owl_text_wordwrap(const char *in, int col) 191 191 { 192 192 char *out; … … 269 269 * Caller must free returned string. 270 270 */ 271 char *owl_text_substitute(const char *in, const char *from, const char *to)271 G_GNUC_WARN_UNUSED_RESULT char *owl_text_substitute(const char *in, const char *from, const char *to) 272 272 { 273 273 char **split = g_strsplit(in, from, 0), *out; … … 284 284 * On success returns the string, on error returns NULL. 285 285 */ 286 char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)286 G_GNUC_WARN_UNUSED_RESULT char *owl_text_quote(const char *in, const char *toquote, const char *quotestr) 287 287 { 288 288 int i, x, r, place, escape; -
util.c
r83a4af3 rd427f08 35 35 * duplicate slashes are removed. Caller must free the return. 36 36 */ 37 char *owl_util_makepath(const char *in)37 G_GNUC_WARN_UNUSED_RESULT char *owl_util_makepath(const char *in) 38 38 { 39 39 int i, j, x; … … 102 102 to -1, argv will be NULL and the caller does not need to free anything. The 103 103 returned vector is NULL-terminated. */ 104 char **owl_parseline(const char *line, int *argc)104 G_GNUC_WARN_UNUSED_RESULT char **owl_parseline(const char *line, int *argc) 105 105 { 106 106 GPtrArray *argv; … … 245 245 } 246 246 247 char *owl_string_build_quoted(const char *tmpl, ...)247 G_GNUC_WARN_UNUSED_RESULT char *owl_string_build_quoted(const char *tmpl, ...) 248 248 { 249 249 GString *buf = g_string_new(""); … … 257 257 /* Returns a quoted version of arg suitable for placing in a 258 258 * command-line. Result should be freed with g_free. */ 259 char *owl_arg_quote(const char *arg)259 G_GNUC_WARN_UNUSED_RESULT char *owl_arg_quote(const char *arg) 260 260 { 261 261 GString *buf = g_string_new("");; … … 265 265 266 266 /* caller must free the return */ 267 char *owl_util_minutes_to_timestr(int in)267 G_GNUC_WARN_UNUSED_RESULT char *owl_util_minutes_to_timestr(int in) 268 268 { 269 269 int days, hours; … … 331 331 332 332 /* Get the default tty name. Caller must free the return */ 333 char *owl_util_get_default_tty(void)333 G_GNUC_WARN_UNUSED_RESULT char *owl_util_get_default_tty(void) 334 334 { 335 335 const char *tmp; … … 353 353 * return. 354 354 */ 355 char *owl_util_stripnewlines(const char *in)355 G_GNUC_WARN_UNUSED_RESULT char *owl_util_stripnewlines(const char *in) 356 356 { 357 357 … … 384 384 * Error conditions are the same as g_file_read_link. 385 385 */ 386 gchar *owl_util_recursive_resolve_link(const char *filename)386 G_GNUC_WARN_UNUSED_RESULT gchar *owl_util_recursive_resolve_link(const char *filename) 387 387 { 388 388 gchar *last_path = g_strdup(filename); … … 511 511 The caller is responsible for freeing the allocated string. 512 512 */ 513 char * owl_util_baseclass(const char *class)513 G_GNUC_WARN_UNUSED_RESULT char *owl_util_baseclass(const char *class) 514 514 { 515 515 char *start, *end; … … 546 546 547 547 /* Strips format characters from a valid utf-8 string. Returns the 548 empty string if 'in' does not validate. */549 char *owl_strip_format_chars(const char *in)548 empty string if 'in' does not validate. Caller must free the return. */ 549 G_GNUC_WARN_UNUSED_RESULT char *owl_strip_format_chars(const char *in) 550 550 { 551 551 char *r; … … 584 584 * out characters in Unicode Plane 16, as we use that plane internally 585 585 * for formatting. 586 */ 587 char * owl_validate_or_convert(const char *in) 586 * Caller must free the return. 587 */ 588 G_GNUC_WARN_UNUSED_RESULT char *owl_validate_or_convert(const char *in) 588 589 { 589 590 if (g_utf8_validate(in, -1, NULL)) { … … 599 600 * Validate 'in' as UTF-8, and either return a copy of it, or an empty 600 601 * string if it is invalid utf-8. 601 */ 602 char * owl_validate_utf8(const char *in) 602 * Caller must free the return. 603 */ 604 G_GNUC_WARN_UNUSED_RESULT char *owl_validate_utf8(const char *in) 603 605 { 604 606 char *out; … … 632 634 } 633 635 634 char *owl_escape_highbit(const char *str) 636 /* caller must free the return */ 637 G_GNUC_WARN_UNUSED_RESULT char *owl_escape_highbit(const char *str) 635 638 { 636 639 GString *out = g_string_new(""); … … 695 698 696 699 /* Read the rest of the input available in fp into a string. */ 697 char *owl_slurp(FILE *fp)700 G_GNUC_WARN_UNUSED_RESULT char *owl_slurp(FILE *fp) 698 701 { 699 702 char *buf = NULL; -
variable.c
r72146c7 rd427f08 646 646 } 647 647 648 owl_variable * owl_variable_newvar(const char *name, const char *summary, const char * description) { 648 G_GNUC_WARN_UNUSED_RESULT owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description) 649 { 649 650 owl_variable * var = g_new0(owl_variable, 1); 650 651 var->name = g_strdup(name); … … 824 825 } 825 826 826 char *owl_variable_get_tostring(const owl_vardict *d, const char *name) { 827 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d, const char *name) 828 { 827 829 owl_variable *v; 828 830 if (!name) return NULL; … … 832 834 } 833 835 834 char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name) { 836 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name) 837 { 835 838 owl_variable *v; 836 839 if (!name) return NULL; … … 992 995 } 993 996 994 char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val) { 997 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val) 998 { 995 999 if (val == NULL) { 996 1000 return g_strdup("<null>"); … … 1027 1031 } 1028 1032 1029 char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val) { 1033 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val) 1034 { 1030 1035 if (val == NULL) { 1031 1036 return g_strdup("<null>"); … … 1066 1071 } 1067 1072 1068 char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val) { 1073 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val) 1074 { 1069 1075 char **enums; 1070 1076 int nenums, i; … … 1106 1112 } 1107 1113 1108 char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) { 1114 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) 1115 { 1109 1116 if (val == NULL) { 1110 1117 return g_strdup("<null>"); -
viewwin.c
r4fd211f rd427f08 12 12 * will be used by the viewwin 13 13 */ 14 owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)14 G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text) 15 15 { 16 16 owl_viewwin *v = g_new0(owl_viewwin, 1); … … 34 34 * will be used by the viewwin 35 35 */ 36 owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)36 G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext) 37 37 { 38 38 char *text; … … 237 237 } 238 238 239 owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {239 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) { 240 240 int lines, cols; 241 241 owl_editwin *cmdline; -
window.c
rf97c1a6 rd427f08 569 569 }; 570 570 571 GSource *owl_window_redraw_source_new(void) { 571 G_GNUC_WARN_UNUSED_RESULT GSource *owl_window_redraw_source_new(void) 572 { 572 573 GSource *source; 573 574 source = g_source_new(&redraw_funcs, sizeof(GSource)); -
zcrypt.c
r5b197f7 rd427f08 53 53 } ZWRITEOPTIONS; 54 54 55 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);55 G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance); 56 56 int ParseCryptSpec(const char *spec, const char **keyfile); 57 char *BuildArgString(char **argv, int start, int end);58 char *read_keystring(const char *keyfile);57 G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end); 58 G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile); 59 59 60 60 int do_encrypt(int zephyr, const char *class, const char *instance, … … 364 364 /* Build a space-separated string from argv from elements between start * 365 365 * and end - 1. malloc()'s the returned string. */ 366 char *BuildArgString(char **argv, int start, int end)366 G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end) 367 367 { 368 368 int len = 1; … … 401 401 #define MAX_SEARCH 3 402 402 /* Find the class/instance in the .crypt-table */ 403 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)403 G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance) 404 404 { 405 405 char *keyfile = NULL; … … 579 579 } 580 580 581 char *slurp_stdin(int ignoredot, int *length) {581 G_GNUC_WARN_UNUSED_RESULT char *slurp_stdin(int ignoredot, int *length) { 582 582 char *buf; 583 583 char *inptr; … … 611 611 } 612 612 613 char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {613 G_GNUC_WARN_UNUSED_RESULT char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) { 614 614 char *buf; 615 615 … … 637 637 } 638 638 639 char *read_keystring(const char *keyfile) {639 G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile) { 640 640 char *keystring; 641 641 FILE *fkey = fopen(keyfile, "r"); -
zephyr.c
re146cd7 rd427f08 524 524 */ 525 525 #ifdef HAVE_LIBZEPHYR 526 char *owl_zephyr_get_field(const ZNotice_t *n, int j)526 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j) 527 527 { 528 528 int i, count, save; … … 552 552 } 553 553 554 char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)554 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j) 555 555 { 556 556 int i, count, save; … … 584 584 } 585 585 #else 586 char *owl_zephyr_get_field(void *n, int j)586 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j) 587 587 { 588 588 return(g_strdup("")); 589 589 } 590 char *owl_zephyr_get_field_as_utf8(void *n, int j)590 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j) 591 591 { 592 592 return owl_zephyr_get_field(n, j); … … 621 621 * caller must free the return 622 622 */ 623 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)623 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m) 624 624 { 625 625 #define OWL_NFIELDS 5 … … 942 942 #endif 943 943 944 char *owl_zephyr_zlocate(const char *user, int auth)944 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth) 945 945 { 946 946 #ifdef HAVE_LIBZEPHYR … … 1042 1042 1043 1043 /* caller must free the return */ 1044 char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)1044 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip) 1045 1045 { 1046 1046 return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip); … … 1122 1122 * free the return. 1123 1123 */ 1124 char *owl_zephyr_getsubs(void)1124 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void) 1125 1125 { 1126 1126 #ifdef HAVE_LIBZEPHYR … … 1242 1242 * The caller must free the return 1243 1243 */ 1244 char *short_zuser(const char *in)1244 G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in) 1245 1245 { 1246 1246 char *ptr = strrchr(in, '@'); … … 1254 1254 * The caller must free the return. 1255 1255 */ 1256 char *long_zuser(const char *in)1256 G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in) 1257 1257 { 1258 1258 char *ptr = strrchr(in, '@'); … … 1282 1282 * caller must free the return. 1283 1283 */ 1284 char *owl_zephyr_smartstripped_user(const char *in)1284 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in) 1285 1285 { 1286 1286 char *slash, *dot, *realm, *out; -
zwrite.c
r3b8a563 rd427f08 5 5 #include "owl.h" 6 6 7 owl_zwrite *owl_zwrite_new(const char *line)7 G_GNUC_WARN_UNUSED_RESULT owl_zwrite *owl_zwrite_new(const char *line) 8 8 { 9 9 owl_zwrite *z = g_new(owl_zwrite, 1); … … 15 15 } 16 16 17 int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)17 G_GNUC_WARN_UNUSED_RESULT int owl_zwrite_create_from_line(owl_zwrite *z, const char *line) 18 18 { 19 19 int argc, badargs, myargc; … … 321 321 322 322 /* Caller must free the result. */ 323 char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)323 G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n) 324 324 { 325 325 if (z->realm[0]) { … … 370 370 * If not a CC, only the recip_index'th user will be replied to. 371 371 */ 372 char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)372 G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index) 373 373 { 374 374 /* Match ordering in zwrite help. */
Note: See TracChangeset
for help on using the changeset viewer.