Browse files

Define CALLER_OWN macro

Replace our exising uses of G_GNUC_WARN_UNUSED_RESULT with it. The
old macro is just way too long. This also more clearly specifies the
intent.
  • Loading branch information...
1 parent 95b52d1 commit 6829afcb7133217c6afdbd7634452d0fabdeaa4f @davidben davidben committed Jun 24, 2011
Showing with 135 additions and 127 deletions.
  1. +1 −1 aim.c
  2. +5 −5 cmd.c
  3. +11 −11 commands.c
  4. +1 −1 context.c
  5. +1 −1 dict.c
  6. +1 −1 editcontext.c
  7. +5 −5 editwin.c
  8. +1 −1 filter.c
  9. +1 −1 fmtext.c
  10. +19 −19 functions.c
  11. +2 −2 global.c
  12. +3 −3 keybinding.c
  13. +1 −1 keymap.c
  14. +1 −1 keypress.c
  15. +4 −4 logging.c
  16. +2 −2 message.c
  17. +7 −3 owl.h
  18. +11 −11 perlconfig.c
  19. +1 −1 popwin.c
  20. +6 −6 text.c
  21. +14 −14 util.c
  22. +7 −7 variable.c
  23. +3 −3 viewwin.c
  24. +1 −1 window.c
  25. +12 −8 zcrypt.c
  26. +11 −11 zephyr.c
  27. +3 −3 zwrite.c
View
2 aim.c
@@ -436,7 +436,7 @@ int owl_aim_chat_sendmsg(const char *chatroom, const char *msg)
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_aim_normalize_screenname(const char *in)
+CALLER_OWN char *owl_aim_normalize_screenname(const char *in)
{
char *out;
int i, j, k;
View
10 cmd.c
@@ -55,7 +55,7 @@ int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) {
}
/* caller must free the return */
-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)
+CALLER_OWN char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff)
{
char *retval = NULL;
const owl_cmd *cmd;
@@ -72,7 +72,7 @@ G_GNUC_WARN_UNUSED_RESULT char *_owl_cmddict_execute(const owl_cmddict *cd, cons
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff)
+CALLER_OWN char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff)
{
char **argv;
int argc;
@@ -96,7 +96,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute(const owl_cmddict *cd, const
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc)
+CALLER_OWN char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc)
{
char *buff;
char *retval = NULL;
@@ -153,7 +153,7 @@ int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) {
}
/* caller must free the result */
-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)
+CALLER_OWN 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)
{
static int alias_recurse_depth = 0;
int ival=0;
@@ -227,7 +227,7 @@ const char *owl_cmd_get_summary(const owl_cmd *cmd) {
}
/* returns a summary line describing this keymap. the caller must free. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_describe(const owl_cmd *cmd)
+CALLER_OWN char *owl_cmd_describe(const owl_cmd *cmd)
{
if (!cmd || !cmd->name || !cmd->summary) return NULL;
return g_strdup_printf("%-25s - %s", cmd->name, cmd->summary);
View
22 commands.c
@@ -1372,7 +1372,7 @@ char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buf
return NULL;
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
{
char *filtname = NULL;
@@ -1412,7 +1412,7 @@ void owl_command_redisplay(void)
owl_function_full_redisplay();
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
{
if(argc != 1)
{
@@ -1643,37 +1643,37 @@ char *owl_command_print(int argc, const char *const *argv, const char *buff)
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_exec(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_exec(int argc, const char *const *argv, const char *buff)
{
return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
{
return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
{
return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_perl(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_perl(int argc, const char *const *argv, const char *buff)
{
return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
{
return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
{
return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_multi(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_multi(int argc, const char *const *argv, const char *buff)
{
char *lastrv = NULL, *newbuff;
char **commands;
@@ -2593,7 +2593,7 @@ char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff)
return(NULL);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
{
const char *stylename;
if (argc != 1) {
@@ -2636,7 +2636,7 @@ char *owl_command_add_cmd_history(int argc, const char *const *argv, const char
return NULL;
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
+CALLER_OWN char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
{
owl_history *hist;
const char *ptr;
View
2 context.c
@@ -5,7 +5,7 @@
#define SET_MODE(ctx, new) ctx->mode = ((ctx->mode)&~OWL_CTX_MODE_BITS)|new
/* TODO: dependency from owl_context -> owl_window is annoying. */
-G_GNUC_WARN_UNUSED_RESULT owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
+CALLER_OWN owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
{
owl_context *c;
if (!(mode & OWL_CTX_MODE_BITS))
View
2 dict.c
@@ -106,7 +106,7 @@ int owl_dict_insert_element(owl_dict *d, const char *k, void *v, void (*delete_o
/* Doesn't free the value of the element, but does
* return it so the caller can free it. */
-G_GNUC_WARN_UNUSED_RESULT void *owl_dict_remove_element(owl_dict *d, const char *k)
+CALLER_OWN void *owl_dict_remove_element(owl_dict *d, const char *k)
{
int i;
int pos, found;
View
2 editcontext.c
@@ -7,7 +7,7 @@ bool owl_is_editcontext(const owl_context *ctx)
return owl_context_matches(ctx, OWL_CTX_TYPWIN);
}
-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)
+CALLER_OWN owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)
{
owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap,
owl_editwin_get_window(e));
View
10 editwin.c
@@ -60,7 +60,7 @@ static gunichar owl_editwin_get_char_at_point(owl_editwin *e);
static int owl_editwin_replace_internal(owl_editwin *e, int replace, const char *s);
static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len);
static int oe_copy_region(owl_editwin *e);
-static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end);
+static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end);
static void oe_destroy_cbdata(owl_editwin *e);
static void oe_dirty(owl_editwin *e);
static void oe_window_resized(owl_window *w, owl_editwin *e);
@@ -69,7 +69,7 @@ static void oe_window_resized(owl_window *w, owl_editwin *e);
#define WHITESPACE " \n\t"
-static G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_allocate(void)
+static CALLER_OWN owl_editwin *owl_editwin_allocate(void)
{
owl_editwin *e = g_new0(owl_editwin, 1);
e->refcount = 1;
@@ -141,7 +141,7 @@ static void _owl_editwin_init(owl_editwin *e,
e->echochar='\0';
}
-G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
+CALLER_OWN owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
{
owl_editwin *e = owl_editwin_allocate();
@@ -1368,7 +1368,7 @@ const char *owl_editwin_get_text(owl_editwin *e)
return(e->buff+e->lock);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_editwin_get_region(owl_editwin *e)
+CALLER_OWN char *owl_editwin_get_region(owl_editwin *e)
{
int start, end;
start = e->index;
@@ -1387,7 +1387,7 @@ int owl_editwin_get_echochar(owl_editwin *e)
return e->echochar;
}
-static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end)
+static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end)
{
char *p;
View
2 filter.c
@@ -199,7 +199,7 @@ int owl_filter_message_match(const owl_filter *f, const owl_message *m)
}
-char G_GNUC_WARN_UNUSED_RESULT *owl_filter_print(const owl_filter *f)
+char CALLER_OWN *owl_filter_print(const owl_filter *f)
{
GString *out = g_string_new("");
View
2 fmtext.c
@@ -170,7 +170,7 @@ void owl_fmtext_append_spaces(owl_fmtext *f, int nspaces)
/* Return a plain version of the fmtext. Caller is responsible for
* freeing the return
*/
-char G_GNUC_WARN_UNUSED_RESULT *owl_fmtext_print_plain(const owl_fmtext *f)
+char CALLER_OWN *owl_fmtext_print_plain(const owl_fmtext *f)
{
return owl_strip_format_chars(f->buff->str);
}
View
38 functions.c
@@ -13,14 +13,14 @@
#include "owl.h"
#include "filterproc.h"
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_command(const char *cmdbuff)
+CALLER_OWN char *owl_function_command(const char *cmdbuff)
{
owl_function_debugmsg("executing command: %s", cmdbuff);
return owl_cmddict_execute(owl_global_get_cmddict(&g),
owl_global_get_context(&g), cmdbuff);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_command_argv(const char *const *argv, int argc)
+CALLER_OWN char *owl_function_command_argv(const char *const *argv, int argc)
{
return owl_cmddict_execute_argv(owl_global_get_cmddict(&g),
owl_global_get_context(&g),
@@ -94,7 +94,7 @@ void owl_function_show_styles(void) {
owl_fmtext_cleanup(&fm);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name)
+CALLER_OWN char *owl_function_style_describe(const char *name)
{
const char *desc;
char *s;
@@ -111,7 +111,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name)
return s;
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_cmd_describe(const char *name)
+CALLER_OWN char *owl_function_cmd_describe(const char *name)
{
const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
if (cmd) return owl_cmd_describe(cmd);
@@ -249,7 +249,7 @@ void owl_function_add_outgoing_zephyrs(const owl_zwrite *z)
* create the message). Does not put it on the global queue. Use
* owl_global_messagequeue_addmsg() for that.
*/
-G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
+CALLER_OWN owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
{
owl_message *m;
@@ -270,7 +270,7 @@ G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char
* Does not append it to the global queue, use
* owl_global_messagequeue_addmsg() for that.
*/
-G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_loopback(const char *body)
+CALLER_OWN owl_message *owl_function_make_outgoing_loopback(const char *body)
{
owl_message *m;
@@ -1899,7 +1899,7 @@ void owl_function_start_command(const char *line)
owl_editwin_set_callback(tw, owl_callback_command);
}
-G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *line)
+CALLER_OWN owl_editwin *owl_function_start_question(const char *line)
{
owl_editwin *tw;
owl_context *ctx;
@@ -1914,7 +1914,7 @@ G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *l
return tw;
}
-G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *line)
+CALLER_OWN owl_editwin *owl_function_start_password(const char *line)
{
owl_editwin *tw;
owl_context *ctx;
@@ -1931,7 +1931,7 @@ G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *l
return tw;
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
+CALLER_OWN char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
{
/* if type == 1 display in a popup
* if type == 2 display an admin messages
@@ -1974,7 +1974,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *a
return NULL;
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
+CALLER_OWN char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
{
/* if type == 1 display in a popup
* if type == 2 display an admin messages
@@ -2144,7 +2144,7 @@ void owl_function_create_filter(int argc, const char *const *argv)
*
* Returns the name of the negated filter, which the caller must free.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_create_negative_filter(const char *filtername)
+CALLER_OWN char *owl_function_create_negative_filter(const char *filtername)
{
char *newname;
const owl_filter *tmpfilt;
@@ -2241,7 +2241,7 @@ void owl_function_show_zpunts(void)
* name of the filter or null. The caller must free this name.
* If 'related' is nonzero, encompass unclasses and .d classes as well.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const char *i, int related)
+CALLER_OWN char *owl_function_classinstfilt(const char *c, const char *i, int related)
{
owl_filter *f;
char *filtname;
@@ -2328,7 +2328,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const
* the configuration to override this function. Returns the name of
* the filter, which the caller must free.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser)
+CALLER_OWN char *owl_function_zuserfilt(const char *longuser)
{
owl_filter *f;
char *argbuff, *esclonguser, *shortuser, *filtname;
@@ -2374,7 +2374,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser)
* created. This allows the configuration to override this function.
* Returns the name of the filter, which the caller must free.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user)
+CALLER_OWN char *owl_function_aimuserfilt(const char *user)
{
owl_filter *f;
char *argbuff, *filtname;
@@ -2412,7 +2412,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user)
return(filtname);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_typefilt(const char *type)
+CALLER_OWN char *owl_function_typefilt(const char *type)
{
owl_filter *f;
char *argbuff, *filtname, *esctype;
@@ -2468,7 +2468,7 @@ void owl_function_delete_curview_msgs(int flag)
owl_mainwin_redisplay(owl_global_get_mainwin(&g));
}
-static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m)
+static CALLER_OWN char *owl_function_smartfilter_cc(const owl_message *m)
{
const char *ccs;
char *ccs_quoted;
@@ -2520,7 +2520,7 @@ static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_mes
* If the curmsg is a personal AIM message returna filter
* name to the AIM conversation with that user
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter(int type, int invert_related)
+CALLER_OWN char *owl_function_smartfilter(int type, int invert_related)
{
const owl_view *v;
const owl_message *m;
@@ -2859,7 +2859,7 @@ void owl_function_show_keymaps(void)
owl_fmtext_cleanup(&fm);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_keymap_summary(const char *name)
+CALLER_OWN char *owl_function_keymap_summary(const char *name)
{
const owl_keymap *km
= owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
@@ -2973,7 +2973,7 @@ void owl_function_search_helper(int consider_current, int direction)
/* strips formatting from ztext and returns the unformatted text.
* caller is responsible for freeing. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_function_ztext_stylestrip(const char *zt)
+CALLER_OWN char *owl_function_ztext_stylestrip(const char *zt)
{
owl_fmtext fm;
char *plaintext;
View
4 global.c
@@ -171,7 +171,7 @@ void owl_global_push_context_obj(owl_global *g, owl_context *c)
/* Pops the current context from the context stack and returns it. Caller is
* responsible for freeing. */
-G_GNUC_WARN_UNUSED_RESULT owl_context *owl_global_pop_context_no_delete(owl_global *g)
+CALLER_OWN owl_context *owl_global_pop_context_no_delete(owl_global *g)
{
owl_context *c;
if (!g->context_stack)
@@ -724,7 +724,7 @@ void owl_global_messagequeue_addmsg(owl_global *g, owl_message *m)
* is empty. The caller should free the message after using it, if
* necessary.
*/
-owl_message G_GNUC_WARN_UNUSED_RESULT *owl_global_messagequeue_popmsg(owl_global *g)
+owl_message CALLER_OWN *owl_global_messagequeue_popmsg(owl_global *g)
{
owl_message *out;
View
6 keybinding.c
@@ -13,7 +13,7 @@
static int owl_keybinding_make_keys(owl_keybinding *kb, const char *keyseq);
/* sets up a new keybinding for a command */
-G_GNUC_WARN_UNUSED_RESULT owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
+CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
{
owl_keybinding *kb = g_new(owl_keybinding, 1);
@@ -84,7 +84,7 @@ void owl_keybinding_execute(const owl_keybinding *kb, int j)
}
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_stack_tostring(int *j, int len)
+CALLER_OWN char *owl_keybinding_stack_tostring(int *j, int len)
{
GString *string;
int i;
@@ -99,7 +99,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_stack_tostring(int *j, int len)
return g_string_free(string, false);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_tostring(const owl_keybinding *kb)
+CALLER_OWN char *owl_keybinding_tostring(const owl_keybinding *kb)
{
return owl_keybinding_stack_tostring(kb->keys, kb->len);
}
View
2 keymap.c
@@ -79,7 +79,7 @@ int owl_keymap_remove_binding(owl_keymap *km, const char *keyseq)
/* returns a summary line describing this keymap. the caller must free. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_keymap_summary(const owl_keymap *km)
+CALLER_OWN char *owl_keymap_summary(const owl_keymap *km)
{
if (!km || !km->name || !km->desc) return NULL;
return g_strdup_printf("%-15s - %s", km->name, km->desc);
View
2 keypress.c
@@ -128,7 +128,7 @@ static const struct _owl_keypress_specialmap {
#define OWL_CTRL(key) ((key)&037)
/* OWL_META is definied in owl.h */
-char G_GNUC_WARN_UNUSED_RESULT *owl_keypress_tostring(int j, int esc)
+char CALLER_OWN *owl_keypress_tostring(int j, int esc)
{
GString *kb;
const struct _owl_keypress_specialmap *sm;
View
8 logging.c
@@ -79,7 +79,7 @@ int owl_log_shouldlog_message(const owl_message *m) {
return(1);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_log_zephyr(const owl_message *m)
+CALLER_OWN char *owl_log_zephyr(const owl_message *m)
{
char *tmp = NULL;
GString *buffer = NULL;
@@ -103,7 +103,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_log_zephyr(const owl_message *m)
return g_string_free(buffer, FALSE);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_log_aim(const owl_message *m)
+CALLER_OWN char *owl_log_aim(const owl_message *m)
{
GString *buffer = NULL;
buffer = g_string_new("");
@@ -121,7 +121,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_log_aim(const owl_message *m)
return g_string_free(buffer, FALSE);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_log_jabber(const owl_message *m)
+CALLER_OWN char *owl_log_jabber(const owl_message *m)
{
GString *buffer = NULL;
buffer = g_string_new("");
@@ -134,7 +134,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_log_jabber(const owl_message *m)
return g_string_free(buffer, FALSE);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_log_generic(const owl_message *m)
+CALLER_OWN char *owl_log_generic(const owl_message *m)
{
GString *buffer;
buffer = g_string_new("");
View
4 message.c
@@ -579,7 +579,7 @@ int owl_message_is_mail(const owl_message *m)
}
/* caller must free return value. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m)
+CALLER_OWN char *owl_message_get_cc(const owl_message *m)
{
const char *cur;
char *out, *end;
@@ -596,7 +596,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m)
}
/* caller must free return value */
-G_GNUC_WARN_UNUSED_RESULT GList *owl_message_get_cc_without_recipient(const owl_message *m)
+CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m)
{
char *cc, *shortuser, *recip;
const char *user;
View
10 owl.h
@@ -199,6 +199,10 @@ typedef void HV;
#define OWL_ENABLE_ZCRYPT 1
#endif
+/* Annotate functions in which the caller owns the return value and is
+ * responsible for ensuring it is freed. */
+#define CALLER_OWN G_GNUC_WARN_UNUSED_RESULT
+
#define OWL_META(key) ((key)|010000)
/* OWL_CTRL is definied in kepress.c */
@@ -250,7 +254,7 @@ typedef struct _owl_variable {
/* returns a reference to the current value.
* WARNING: this approach is hard to make
* thread-safe... */
- char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
+ char CALLER_OWN *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
/* converts val to a string;
* caller must free the result */
void (*delete_fn)(struct _owl_variable *v);
@@ -312,14 +316,14 @@ typedef struct _owl_cmd { /* command */
char *cmd_aliased_to; /* what this command is aliased to... */
/* These don't take any context */
- char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
+ char CALLER_OWN *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
/* takes argv and the full command as buff.
* caller must free return value if !NULL */
void (*cmd_v_fn)(void); /* takes no args */
void (*cmd_i_fn)(int i); /* takes an int as an arg */
/* The following also take the active context if it's valid */
- char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
+ char CALLER_OWN *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
/* takes argv and the full command as buff.
* caller must free return value if !NULL */
void (*cmd_ctxv_fn)(void *ctx); /* takes no args */
View
22 perlconfig.c
@@ -22,7 +22,7 @@ void owl_perl_xs_init(pTHX) /* noproto */
}
-G_GNUC_WARN_UNUSED_RESULT SV *owl_new_sv(const char * str)
+CALLER_OWN SV *owl_new_sv(const char * str)
{
SV *ret = newSVpv(str, 0);
if (is_utf8_string((const U8 *)str, strlen(str))) {
@@ -35,7 +35,7 @@ G_GNUC_WARN_UNUSED_RESULT SV *owl_new_sv(const char * str)
return ret;
}
-G_GNUC_WARN_UNUSED_RESULT AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
+CALLER_OWN AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
{
AV *ret;
int i;
@@ -51,7 +51,7 @@ G_GNUC_WARN_UNUSED_RESULT AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const v
return ret;
}
-G_GNUC_WARN_UNUSED_RESULT HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
+CALLER_OWN HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
{
HV *ret;
owl_list l;
@@ -74,7 +74,7 @@ G_GNUC_WARN_UNUSED_RESULT HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const v
return ret;
}
-G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_message2hashref(const owl_message *m)
+CALLER_OWN SV *owl_perlconfig_message2hashref(const owl_message *m)
{
HV *h, *stash;
SV *hr;
@@ -164,7 +164,7 @@ G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_message2hashref(const owl_message *
return hr;
}
-G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_curmessage2hashref(void)
+CALLER_OWN SV *owl_perlconfig_curmessage2hashref(void)
{
int curmsg;
const owl_view *v;
@@ -182,7 +182,7 @@ G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_curmessage2hashref(void)
This has been somewhat addressed, but is still not lossless.
*/
-G_GNUC_WARN_UNUSED_RESULT owl_message *owl_perlconfig_hashref2message(SV *msg)
+CALLER_OWN owl_message *owl_perlconfig_hashref2message(SV *msg)
{
owl_message * m;
HE * ent;
@@ -250,7 +250,7 @@ G_GNUC_WARN_UNUSED_RESULT owl_message *owl_perlconfig_hashref2message(SV *msg)
/* Calls in a scalar context, passing it a hash reference.
If return value is non-null, caller must free. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
+CALLER_OWN char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
{
dSP ;
int count;
@@ -299,7 +299,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *sub
/* Calls a method on a perl object representing a message.
If the return value is non-null, the caller must free it.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
+CALLER_OWN char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
{
dSP;
unsigned int count, i;
@@ -349,7 +349,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_mes
}
/* caller must free result, if not NULL */
-G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv)
+CALLER_OWN char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv)
{
int ret;
PerlInterpreter *p;
@@ -435,7 +435,7 @@ int owl_perlconfig_is_function(const char *fn) {
}
/* caller is responsible for freeing returned string */
-G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line)
+CALLER_OWN char *owl_perlconfig_execute(const char *line)
{
STRLEN len;
SV *response;
@@ -505,7 +505,7 @@ void owl_perlconfig_new_command(const char *name)
}
/* caller must free the result */
-G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
+CALLER_OWN char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
{
int i, count;
char * ret = NULL;
View
2 popwin.c
@@ -1,6 +1,6 @@
#include "owl.h"
-G_GNUC_WARN_UNUSED_RESULT owl_popwin *owl_popwin_new(void)
+CALLER_OWN owl_popwin *owl_popwin_new(void)
{
owl_popwin *pw = g_new0(owl_popwin, 1);
View
12 text.c
@@ -6,7 +6,7 @@
/* Returns a copy of 'in' with each line indented 'n'
* characters. Result must be freed with g_free. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_indent(const char *in, int n)
+CALLER_OWN char *owl_text_indent(const char *in, int n)
{
const char *ptr1, *ptr2, *last;
GString *out = g_string_new("");
@@ -47,7 +47,7 @@ int owl_text_num_lines(const char *in)
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in)
+CALLER_OWN char *owl_text_htmlstrip(const char *in)
{
const char *ptr1, *end, *ptr2, *ptr3;
char *out, *out2;
@@ -128,7 +128,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in)
}
/* Caller must free return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in)
+CALLER_OWN char *owl_text_expand_tabs(const char *in)
{
int len = 0;
const char *p = in;
@@ -187,7 +187,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in)
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_wordwrap(const char *in, int col)
+CALLER_OWN char *owl_text_wordwrap(const char *in, int col)
{
char *out;
int cur, lastspace, len, lastnewline;
@@ -268,7 +268,7 @@ int only_whitespace(const char *s)
/* Return a string with any occurances of 'from' replaced with 'to'.
* Caller must free returned string.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_substitute(const char *in, const char *from, const char *to)
+CALLER_OWN char *owl_text_substitute(const char *in, const char *from, const char *to)
{
char **split = g_strsplit(in, from, 0), *out;
out = g_strjoinv(to, split);
@@ -283,7 +283,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_text_substitute(const char *in, const char *
* permissable for a character in 'quotestr' to be in 'toquote'.
* On success returns the string, on error returns NULL.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
+CALLER_OWN char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
{
int i, x, r, place, escape;
int in_len, toquote_len, quotestr_len;
View
28 util.c
@@ -34,7 +34,7 @@ const char *skiptokens(const char *buff, int n) {
/* Return a "nice" version of the path. Tilde expansion is done, and
* duplicate slashes are removed. Caller must free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_util_makepath(const char *in)
+CALLER_OWN char *owl_util_makepath(const char *in)
{
int i, j, x;
char *out, user[MAXPATHLEN];
@@ -101,7 +101,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_util_makepath(const char *in)
the returned values with g_strfreev. If there is an error argc will be set
to -1, argv will be NULL and the caller does not need to free anything. The
returned vector is NULL-terminated. */
-G_GNUC_WARN_UNUSED_RESULT char **owl_parseline(const char *line, int *argc)
+CALLER_OWN char **owl_parseline(const char *line, int *argc)
{
GPtrArray *argv;
int i, len, between=1;
@@ -244,7 +244,7 @@ void owl_string_vappendf_quoted(GString *buf, const char *tmpl, va_list ap)
g_string_append(buf, last);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_string_build_quoted(const char *tmpl, ...)
+CALLER_OWN char *owl_string_build_quoted(const char *tmpl, ...)
{
GString *buf = g_string_new("");
va_list ap;
@@ -256,15 +256,15 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_string_build_quoted(const char *tmpl, ...)
/* Returns a quoted version of arg suitable for placing in a
* command-line. Result should be freed with g_free. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_arg_quote(const char *arg)
+CALLER_OWN char *owl_arg_quote(const char *arg)
{
GString *buf = g_string_new("");;
owl_string_append_quoted_arg(buf, arg);
return g_string_free(buf, false);
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_util_minutes_to_timestr(int in)
+CALLER_OWN char *owl_util_minutes_to_timestr(int in)
{
int days, hours;
long run;
@@ -330,7 +330,7 @@ const char *owl_util_color_to_string(int color)
}
/* Get the default tty name. Caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_util_get_default_tty(void)
+CALLER_OWN char *owl_util_get_default_tty(void)
{
const char *tmp;
char *out;
@@ -352,7 +352,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_util_get_default_tty(void)
/* strip leading and trailing new lines. Caller must free the
* return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_util_stripnewlines(const char *in)
+CALLER_OWN char *owl_util_stripnewlines(const char *in)
{
char *tmp, *ptr1, *ptr2, *out;
@@ -383,7 +383,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_util_stripnewlines(const char *in)
*
* Error conditions are the same as g_file_read_link.
*/
-G_GNUC_WARN_UNUSED_RESULT gchar *owl_util_recursive_resolve_link(const char *filename)
+CALLER_OWN gchar *owl_util_recursive_resolve_link(const char *filename)
{
gchar *last_path = g_strdup(filename);
GError *err = NULL;
@@ -510,7 +510,7 @@ int owl_util_file_deleteline(const char *filename, const char *line, int backup)
leading `un' or trailing `.d'.
The caller is responsible for freeing the allocated string.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_util_baseclass(const char *class)
+CALLER_OWN char *owl_util_baseclass(const char *class)
{
char *start, *end;
@@ -546,7 +546,7 @@ const char * owl_get_bindir(void)
/* Strips format characters from a valid utf-8 string. Returns the
empty string if 'in' does not validate. Caller must free the return. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_strip_format_chars(const char *in)
+CALLER_OWN char *owl_strip_format_chars(const char *in)
{
char *r;
if (g_utf8_validate(in, -1, NULL)) {
@@ -585,7 +585,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_strip_format_chars(const char *in)
* for formatting.
* Caller must free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_validate_or_convert(const char *in)
+CALLER_OWN char *owl_validate_or_convert(const char *in)
{
if (g_utf8_validate(in, -1, NULL)) {
return owl_strip_format_chars(in);
@@ -601,7 +601,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_validate_or_convert(const char *in)
* string if it is invalid utf-8.
* Caller must free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_validate_utf8(const char *in)
+CALLER_OWN char *owl_validate_utf8(const char *in)
{
char *out;
if (g_utf8_validate(in, -1, NULL)) {
@@ -634,7 +634,7 @@ int owl_util_can_break_after(gunichar c)
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_escape_highbit(const char *str)
+CALLER_OWN char *owl_escape_highbit(const char *str)
{
GString *out = g_string_new("");
unsigned char c;
@@ -697,7 +697,7 @@ int owl_getline_chomp(char **s, FILE *fp)
}
/* Read the rest of the input available in fp into a string. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_slurp(FILE *fp)
+CALLER_OWN char *owl_slurp(FILE *fp)
{
char *buf = NULL;
char *p;
View
14 variable.c
@@ -645,7 +645,7 @@ void owl_variable_dict_add_variable(owl_vardict * vardict,
owl_dict_insert_element(vardict, var->name, var, (void (*)(void *))owl_variable_delete);
}
-G_GNUC_WARN_UNUSED_RESULT owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description)
+CALLER_OWN owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description)
{
owl_variable * var = g_new0(owl_variable, 1);
var->name = g_strdup(name);
@@ -824,7 +824,7 @@ int owl_variable_set_bool_off(owl_vardict *d, const char *name) {
return owl_variable_set_int(d,name,0);
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d, const char *name)
+CALLER_OWN char *owl_variable_get_tostring(const owl_vardict *d, const char *name)
{
owl_variable *v;
if (!name) return NULL;
@@ -833,7 +833,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d,
return v->get_tostring_fn(v, v->get_fn(v));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name)
+CALLER_OWN char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name)
{
owl_variable *v;
if (!name) return NULL;
@@ -994,7 +994,7 @@ int owl_variable_bool_set_fromstring_default(owl_variable *v, const char *newval
return (v->set_fn(v, &i));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val)
+CALLER_OWN char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val)
{
if (val == NULL) {
return g_strdup("<null>");
@@ -1030,7 +1030,7 @@ int owl_variable_int_set_fromstring_default(owl_variable *v, const char *newval)
return (v->set_fn(v, &i));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val)
+CALLER_OWN char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val)
{
if (val == NULL) {
return g_strdup("<null>");
@@ -1070,7 +1070,7 @@ int owl_variable_enum_set_fromstring(owl_variable *v, const char *newval) {
return (v->set_fn(v, &val));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val)
+CALLER_OWN char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val)
{
char **enums;
int nenums, i;
@@ -1111,7 +1111,7 @@ int owl_variable_string_set_fromstring_default(owl_variable *v, const char *newv
return (v->set_fn(v, newval));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
+CALLER_OWN char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
{
if (val == NULL) {
return g_strdup("<null>");
View
6 viewwin.c
@@ -11,7 +11,7 @@ static void owl_viewwin_set_window(owl_viewwin *v, owl_window *w);
/* Create a viewwin. 'win' is an already initialized owl_window that
* will be used by the viewwin
*/
-G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
+CALLER_OWN owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
{
owl_viewwin *v = g_new0(owl_viewwin, 1);
owl_fmtext_init_null(&(v->fmtext));
@@ -33,7 +33,7 @@ G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_text(owl_window *win, con
/* Create a viewwin. 'win' is an already initialized owl_window that
* will be used by the viewwin
*/
-G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
+CALLER_OWN owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
{
char *text;
owl_viewwin *v = g_new0(owl_viewwin, 1);
@@ -236,7 +236,7 @@ void owl_viewwin_deactivate_editcontext(owl_context *ctx) {
owl_viewwin_set_typwin_inactive(v);
}
-G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
+CALLER_OWN owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
int lines, cols;
owl_editwin *cmdline;
if (v->cmdwin)
View
2 window.c
@@ -568,7 +568,7 @@ static GSourceFuncs redraw_funcs = {
NULL
};
-G_GNUC_WARN_UNUSED_RESULT GSource *owl_window_redraw_source_new(void)
+CALLER_OWN GSource *owl_window_redraw_source_new(void)
{
GSource *source;
source = g_source_new(&redraw_funcs, sizeof(GSource));
View
20 zcrypt.c
@@ -26,6 +26,10 @@
#include "filterproc.h"
+/* Annotate functions in which the caller owns the return value and is
+ * responsible for ensuring it is freed. */
+#define CALLER_OWN G_GNUC_WARN_UNUSED_RESULT
+
#define MAX_KEY 128
#define MAX_LINE 128
#define MAX_RESULT 4096
@@ -52,10 +56,10 @@ typedef struct
char *message;
} ZWRITEOPTIONS;
-G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
+CALLER_OWN char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
int ParseCryptSpec(const char *spec, const char **keyfile);
-G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end);
-G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile);
+CALLER_OWN char *BuildArgString(char **argv, int start, int end);
+CALLER_OWN char *read_keystring(const char *keyfile);
int do_encrypt(int zephyr, const char *class, const char *instance,
ZWRITEOPTIONS *zoptions, const char* keyfile, int cipher);
@@ -363,7 +367,7 @@ int ParseCryptSpec(const char *spec, const char **keyfile) {
/* Build a space-separated string from argv from elements between start *
* and end - 1. malloc()'s the returned string. */
-G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end)
+CALLER_OWN char *BuildArgString(char **argv, int start, int end)
{
int len = 1;
int i;
@@ -400,7 +404,7 @@ G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end)
#define MAX_BUFF 258
#define MAX_SEARCH 3
/* Find the class/instance in the .crypt-table */
-G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
+CALLER_OWN char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
{
char *keyfile = NULL;
char *varname[MAX_SEARCH];
@@ -578,7 +582,7 @@ void block_to_ascii(unsigned char *output, FILE *outfile)
}
}
-G_GNUC_WARN_UNUSED_RESULT char *slurp_stdin(int ignoredot, int *length) {
+CALLER_OWN char *slurp_stdin(int ignoredot, int *length) {
char *buf;
char *inptr;
@@ -610,7 +614,7 @@ G_GNUC_WARN_UNUSED_RESULT char *slurp_stdin(int ignoredot, int *length) {
return buf;
}
-G_GNUC_WARN_UNUSED_RESULT char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
+CALLER_OWN char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
char *buf;
if (zoptions->flags & ZCRYPT_OPT_MESSAGE)
@@ -636,7 +640,7 @@ G_GNUC_WARN_UNUSED_RESULT char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *len
return buf;
}
-G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile) {
+CALLER_OWN char *read_keystring(const char *keyfile) {
char *keystring;
FILE *fkey = fopen(keyfile, "r");
if(!fkey) {
View
22 zephyr.c
@@ -523,7 +523,7 @@ int owl_zephyr_unsub(const char *class, const char *inst, const char *recip)
* definition). Caller must free the return.
*/
#ifdef HAVE_LIBZEPHYR
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
+CALLER_OWN char *owl_zephyr_get_field(const ZNotice_t *n, int j)
{
int i, count, save;
@@ -551,7 +551,7 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
return(g_strdup(""));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
+CALLER_OWN char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
{
int i, count, save;
@@ -583,11 +583,11 @@ G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n,
return(g_strdup(""));
}
#else
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j)
+CALLER_OWN char *owl_zephyr_get_field(void *n, int j)
{
return(g_strdup(""));
}
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j)
+CALLER_OWN char *owl_zephyr_get_field_as_utf8(void *n, int j)
{
return owl_zephyr_get_field(n, j);
}
@@ -620,7 +620,7 @@ int owl_zephyr_get_num_fields(const void *n)
/* return a pointer to the message, place the message length in k
* caller must free the return
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
+CALLER_OWN char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
{
#define OWL_NFIELDS 5
int i;
@@ -941,7 +941,7 @@ void owl_zephyr_hackaway_cr(ZNotice_t *n)
}
#endif
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth)
+CALLER_OWN char *owl_zephyr_zlocate(const char *user, int auth)
{
#ifdef HAVE_LIBZEPHYR
int ret, numlocs;
@@ -1041,7 +1041,7 @@ void owl_zephyr_delsub(const char *filename, const char *class, const char *inst
}
/* caller must free the return */
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
+CALLER_OWN char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
{
return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip);
}
@@ -1121,7 +1121,7 @@ const char *owl_zephyr_get_authstr(const void *n)
/* Returns a buffer of subscriptions or an error message. Caller must
* free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void)
+CALLER_OWN char *owl_zephyr_getsubs(void)
{
#ifdef HAVE_LIBZEPHYR
Code_t ret;
@@ -1241,7 +1241,7 @@ int owl_zephyr_set_exposure(const char *exposure)
/* Strip a local realm fron the zephyr user name.
* The caller must free the return
*/
-G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
+CALLER_OWN char *short_zuser(const char *in)
{
char *ptr = strrchr(in, '@');
if (ptr && (ptr[1] == '\0' || !strcasecmp(ptr+1, owl_zephyr_get_realm()))) {
@@ -1253,7 +1253,7 @@ G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
/* Append a local realm to the zephyr user name if necessary.
* The caller must free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in)
+CALLER_OWN char *long_zuser(const char *in)
{
char *ptr = strrchr(in, '@');
if (ptr) {
@@ -1281,7 +1281,7 @@ const char *zuser_realm(const char *in)
* alone. Also leave rcmd. and daemon. krb4 principals alone. The
* caller must free the return.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in)
+CALLER_OWN char *owl_zephyr_smartstripped_user(const char *in)
{
char *slash, *dot, *realm, *out;
View
6 zwrite.c
@@ -4,7 +4,7 @@
#include <unistd.h>
#include "owl.h"
-G_GNUC_WARN_UNUSED_RESULT owl_zwrite *owl_zwrite_new(const char *line)
+CALLER_OWN owl_zwrite *owl_zwrite_new(const char *line)
{
owl_zwrite *z = g_new(owl_zwrite, 1);
if (owl_zwrite_create_from_line(z, line) < 0) {
@@ -320,7 +320,7 @@ const char *owl_zwrite_get_recip_n(const owl_zwrite *z, int n)
}
/* Caller must free the result. */
-G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
+CALLER_OWN char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
{
if (z->realm[0]) {
return g_strdup_printf("%s@%s", owl_zwrite_get_recip_n(z, n), z->realm);
@@ -369,7 +369,7 @@ void owl_zwrite_cleanup(owl_zwrite *z)
*
* If not a CC, only the recip_index'th user will be replied to.
*/
-G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
+CALLER_OWN char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
{
/* Match ordering in zwrite help. */
GString *buf = g_string_new("");

0 comments on commit 6829afc

Please sign in to comment.