Changeset b0e6560
- Timestamp:
- Jun 19, 2011, 4:40:05 AM (13 years ago)
- Parents:
- 9d43dcc (diff), 7dfe886 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
aim.c
rdc1edbd r7dfe886 428 428 429 429 /* caller must free the return */ 430 char *owl_aim_normalize_screenname(const char *in)430 G_GNUC_WARN_UNUSED_RESULT char *owl_aim_normalize_screenname(const char *in) 431 431 { 432 432 char *out; -
cmd.c
raad166a r7dfe886 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
r117c21c r7dfe886 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[] = { … … 1041 1041 }; 1042 1042 1043 int ret =owl_cmddict_add_from_list(cd, commands_to_init);1043 owl_cmddict_add_from_list(cd, commands_to_init); 1044 1044 owl_cmd *cmd; 1045 1045 for (cmd = commands_to_init; cmd->name != NULL; cmd++) 1046 1046 owl_cmd_cleanup(cmd); 1047 return ret;1048 1047 } 1049 1048 … … 1375 1374 } 1376 1375 1377 char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)1376 G_GNUC_WARN_UNUSED_RESULT char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff) 1378 1377 { 1379 1378 char *filtname = NULL; … … 1415 1414 } 1416 1415 1417 char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)1416 G_GNUC_WARN_UNUSED_RESULT char *owl_command_get_shift(int argc, const char *const *argv, const char *buff) 1418 1417 { 1419 1418 if(argc != 1) … … 1646 1645 1647 1646 1648 char *owl_command_exec(int argc, const char *const *argv, const char *buff)1647 G_GNUC_WARN_UNUSED_RESULT char *owl_command_exec(int argc, const char *const *argv, const char *buff) 1649 1648 { 1650 1649 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN); 1651 1650 } 1652 1651 1653 char *owl_command_pexec(int argc, const char *const *argv, const char *buff)1652 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pexec(int argc, const char *const *argv, const char *buff) 1654 1653 { 1655 1654 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP); 1656 1655 } 1657 1656 1658 char *owl_command_aexec(int argc, const char *const *argv, const char *buff)1657 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aexec(int argc, const char *const *argv, const char *buff) 1659 1658 { 1660 1659 return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1661 1660 } 1662 1661 1663 char *owl_command_perl(int argc, const char *const *argv, const char *buff)1662 G_GNUC_WARN_UNUSED_RESULT char *owl_command_perl(int argc, const char *const *argv, const char *buff) 1664 1663 { 1665 1664 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN); 1666 1665 } 1667 1666 1668 char *owl_command_pperl(int argc, const char *const *argv, const char *buff)1667 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pperl(int argc, const char *const *argv, const char *buff) 1669 1668 { 1670 1669 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP); 1671 1670 } 1672 1671 1673 char *owl_command_aperl(int argc, const char *const *argv, const char *buff)1672 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aperl(int argc, const char *const *argv, const char *buff) 1674 1673 { 1675 1674 return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG); 1676 1675 } 1677 1676 1678 char *owl_command_multi(int argc, const char *const *argv, const char *buff)1677 G_GNUC_WARN_UNUSED_RESULT char *owl_command_multi(int argc, const char *const *argv, const char *buff) 1679 1678 { 1680 1679 char *lastrv = NULL, *newbuff; … … 2598 2597 } 2599 2598 2600 char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)2599 G_GNUC_WARN_UNUSED_RESULT char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) 2601 2600 { 2602 2601 const char *stylename; … … 2642 2641 } 2643 2642 2644 char *owl_command_with_history(int argc, const char *const *argv, const char *buff)2643 G_GNUC_WARN_UNUSED_RESULT char *owl_command_with_history(int argc, const char *const *argv, const char *buff) 2645 2644 { 2646 2645 owl_history *hist; -
context.c
rd4927a7 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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
r259e60a8 r7dfe886 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), … … 125 125 } 126 126 127 char *owl_function_style_describe(const char *name) { 127 G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name) 128 { 128 129 const char *desc; 129 130 char *s; … … 141 142 } 142 143 143 char *owl_function_cmd_describe(const char *name)144 G_GNUC_WARN_UNUSED_RESULT char *owl_function_cmd_describe(const char *name) 144 145 { 145 146 const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 279 280 * owl_global_messagequeue_addmsg() for that. 280 281 */ 281 owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)282 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char *body, const char *to) 282 283 { 283 284 owl_message *m; … … 300 301 * owl_global_messagequeue_addmsg() for that. 301 302 */ 302 owl_message *owl_function_make_outgoing_loopback(const char *body)303 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_loopback(const char *body) 303 304 { 304 305 owl_message *m; … … 1929 1930 } 1930 1931 1931 owl_editwin *owl_function_start_question(const char *line)1932 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *line) 1932 1933 { 1933 1934 owl_editwin *tw; … … 1944 1945 } 1945 1946 1946 owl_editwin *owl_function_start_password(const char *line)1947 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *line) 1947 1948 { 1948 1949 owl_editwin *tw; … … 1961 1962 } 1962 1963 1963 char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)1964 G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type) 1964 1965 { 1965 1966 /* if type == 1 display in a popup … … 2004 2005 } 2005 2006 2006 char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)2007 G_GNUC_WARN_UNUSED_RESULT char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type) 2007 2008 { 2008 2009 /* if type == 1 display in a popup … … 2174 2175 * Returns the name of the negated filter, which the caller must free. 2175 2176 */ 2176 char *owl_function_create_negative_filter(const char *filtername)2177 G_GNUC_WARN_UNUSED_RESULT char *owl_function_create_negative_filter(const char *filtername) 2177 2178 { 2178 2179 char *newname; … … 2271 2272 * If 'related' is nonzero, encompass unclasses and .d classes as well. 2272 2273 */ 2273 char *owl_function_classinstfilt(const char *c, const char *i, int related)2274 G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const char *i, int related) 2274 2275 { 2275 2276 owl_filter *f; … … 2358 2359 * the filter, which the caller must free. 2359 2360 */ 2360 char *owl_function_zuserfilt(const char *longuser)2361 G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser) 2361 2362 { 2362 2363 owl_filter *f; … … 2404 2405 * Returns the name of the filter, which the caller must free. 2405 2406 */ 2406 char *owl_function_aimuserfilt(const char *user)2407 G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user) 2407 2408 { 2408 2409 owl_filter *f; … … 2442 2443 } 2443 2444 2444 char *owl_function_typefilt(const char *type)2445 G_GNUC_WARN_UNUSED_RESULT char *owl_function_typefilt(const char *type) 2445 2446 { 2446 2447 owl_filter *f; … … 2498 2499 } 2499 2500 2500 static char *owl_function_smartfilter_cc(const owl_message *m) { 2501 static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m) 2502 { 2501 2503 const char *ccs; 2502 2504 char *ccs_quoted; … … 2549 2551 * name to the AIM conversation with that user 2550 2552 */ 2551 char *owl_function_smartfilter(int type, int invert_related)2553 G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter(int type, int invert_related) 2552 2554 { 2553 2555 const owl_view *v; … … 2888 2890 } 2889 2891 2890 char *owl_function_keymap_summary(const char *name)2892 G_GNUC_WARN_UNUSED_RESULT char *owl_function_keymap_summary(const char *name) 2891 2893 { 2892 2894 const owl_keymap *km … … 3002 3004 /* strips formatting from ztext and returns the unformatted text. 3003 3005 * caller is responsible for freeing. */ 3004 char *owl_function_ztext_stylestrip(const char *zt)3006 G_GNUC_WARN_UNUSED_RESULT char *owl_function_ztext_stylestrip(const char *zt) 3005 3007 { 3006 3008 owl_fmtext fm; -
global.c
rf97c1a6 r7dfe886 175 175 /* Pops the current context from the context stack and returns it. Caller is 176 176 * responsible for freeing. */ 177 owl_context *owl_global_pop_context_no_delete(owl_global *g) { 177 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_global_pop_context_no_delete(owl_global *g) 178 { 178 179 owl_context *c; 179 180 if (!g->context_stack) … … 727 728 * necessary. 728 729 */ 729 owl_message *owl_global_messagequeue_popmsg(owl_global *g)730 owl_message G_GNUC_WARN_UNUSED_RESULT *owl_global_messagequeue_popmsg(owl_global *g) 730 731 { 731 732 owl_message *out; -
keybinding.c
r3b8a563 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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
r24a791f r7dfe886 255 255 * WARNING: this approach is hard to make 256 256 * thread-safe... */ 257 char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);257 char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val); 258 258 /* converts val to a string; 259 259 * caller must free the result */ … … 317 317 318 318 /* These don't take any context */ 319 char *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);319 char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff); 320 320 /* takes argv and the full command as buff. 321 321 * caller must free return value if !NULL */ … … 324 324 325 325 /* The following also take the active context if it's valid */ 326 char *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);326 char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff); 327 327 /* takes argv and the full command as buff. 328 328 * caller must free return value if !NULL */ -
perlconfig.c
ra9237aa r7dfe886 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; … … 250 250 /* Calls in a scalar context, passing it a hash reference. 251 251 If return value is non-null, caller must free. */ 252 char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)252 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m) 253 253 { 254 254 dSP ; … … 299 299 If the return value is non-null, the caller must free it. 300 300 */ 301 char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)301 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv) 302 302 { 303 303 dSP; … … 348 348 } 349 349 350 351 char *owl_perlconfig_initperl(const char * file, int *Pargc, char ***Pargv, char ***Penv)350 /* caller must free result, if not NULL */ 351 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv) 352 352 { 353 353 int ret; … … 435 435 436 436 /* caller is responsible for freeing returned string */ 437 char *owl_perlconfig_execute(const char *line)437 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line) 438 438 { 439 439 STRLEN len; … … 504 504 } 505 505 506 char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 506 /* caller must free the result */ 507 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv) 507 508 { 508 509 int i, count; -
popwin.c
rddbbcffa r7dfe886 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 r7dfe886 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 r7dfe886 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 r7dfe886 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
r9efc154 r7dfe886 647 647 } 648 648 649 owl_variable * owl_variable_newvar(const char *name, const char *summary, const char * description) { 649 G_GNUC_WARN_UNUSED_RESULT owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description) 650 { 650 651 owl_variable * var = g_new0(owl_variable, 1); 651 652 var->name = g_strdup(name); … … 825 826 } 826 827 827 char *owl_variable_get_tostring(const owl_vardict *d, const char *name) { 828 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d, const char *name) 829 { 828 830 owl_variable *v; 829 831 if (!name) return NULL; … … 833 835 } 834 836 835 char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name) { 837 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name) 838 { 836 839 owl_variable *v; 837 840 if (!name) return NULL; … … 993 996 } 994 997 995 char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val) { 998 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val) 999 { 996 1000 if (val == NULL) { 997 1001 return g_strdup("<null>"); … … 1028 1032 } 1029 1033 1030 char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val) { 1034 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val) 1035 { 1031 1036 if (val == NULL) { 1032 1037 return g_strdup("<null>"); … … 1067 1072 } 1068 1073 1069 char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val) { 1074 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val) 1075 { 1070 1076 char **enums; 1071 1077 int nenums, i; … … 1107 1113 } 1108 1114 1109 char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) { 1115 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) 1116 { 1110 1117 if (val == NULL) { 1111 1118 return g_strdup("<null>"); -
viewwin.c
r4fd211f r7dfe886 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 r7dfe886 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 r7dfe886 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
rb848e30 r7dfe886 521 521 */ 522 522 #ifdef HAVE_LIBZEPHYR 523 char *owl_zephyr_get_field(const ZNotice_t *n, int j)523 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j) 524 524 { 525 525 int i, count, save; … … 549 549 } 550 550 551 char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)551 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j) 552 552 { 553 553 int i, count, save; … … 581 581 } 582 582 #else 583 char *owl_zephyr_get_field(void *n, int j)583 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j) 584 584 { 585 585 return(g_strdup("")); 586 586 } 587 char *owl_zephyr_get_field_as_utf8(void *n, int j)587 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j) 588 588 { 589 589 return owl_zephyr_get_field(n, j); … … 618 618 * caller must free the return 619 619 */ 620 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)620 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m) 621 621 { 622 622 #define OWL_NFIELDS 5 … … 939 939 #endif 940 940 941 char *owl_zephyr_zlocate(const char *user, int auth)941 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth) 942 942 { 943 943 #ifdef HAVE_LIBZEPHYR … … 1039 1039 1040 1040 /* caller must free the return */ 1041 char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)1041 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip) 1042 1042 { 1043 1043 return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip); … … 1119 1119 * free the return. 1120 1120 */ 1121 char *owl_zephyr_getsubs(void)1121 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void) 1122 1122 { 1123 1123 #ifdef HAVE_LIBZEPHYR … … 1239 1239 * The caller must free the return 1240 1240 */ 1241 char *short_zuser(const char *in)1241 G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in) 1242 1242 { 1243 1243 char *ptr = strrchr(in, '@'); … … 1251 1251 * The caller must free the return. 1252 1252 */ 1253 char *long_zuser(const char *in)1253 G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in) 1254 1254 { 1255 1255 char *ptr = strrchr(in, '@'); … … 1279 1279 * caller must free the return. 1280 1280 */ 1281 char *owl_zephyr_smartstripped_user(const char *in)1281 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in) 1282 1282 { 1283 1283 char *slash, *dot, *realm, *out; -
zwrite.c
r3b8a563 r7dfe886 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.