Changeset 6829afc


Ignore:
Timestamp:
Jun 25, 2011, 3:26:15 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
12294d2
Parents:
95b52d1
git-author:
David Benjamin <davidben@mit.edu> (06/24/11 22:56:15)
git-committer:
David Benjamin <davidben@mit.edu> (06/25/11 03:26:15)
Message:
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.
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • aim.c

    rd427f08 r6829afc  
    437437
    438438/* caller must free the return */
    439 G_GNUC_WARN_UNUSED_RESULT char *owl_aim_normalize_screenname(const char *in)
     439CALLER_OWN char *owl_aim_normalize_screenname(const char *in)
    440440{
    441441  char *out;
  • cmd.c

    rd427f08 r6829afc  
    5656
    5757/* 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)
     58CALLER_OWN char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff)
    5959{
    6060  char *retval = NULL;
     
    7373
    7474/* 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)
     75CALLER_OWN char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff)
    7676{
    7777  char **argv;
     
    9797
    9898/* 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)
     99CALLER_OWN char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc)
    100100{
    101101  char *buff;
     
    154154
    155155/* 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)
     156CALLER_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)
    157157{
    158158  static int alias_recurse_depth = 0;
     
    228228
    229229/* returns a summary line describing this keymap.  the caller must free. */
    230 G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_describe(const owl_cmd *cmd)
     230CALLER_OWN char *owl_cmd_describe(const owl_cmd *cmd)
    231231{
    232232  if (!cmd || !cmd->name || !cmd->summary) return NULL;
  • commands.c

    rb470451 r6829afc  
    13731373}
    13741374
    1375 G_GNUC_WARN_UNUSED_RESULT char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
     1375CALLER_OWN char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
    13761376{
    13771377  char *filtname = NULL;
     
    14131413}
    14141414
    1415 G_GNUC_WARN_UNUSED_RESULT char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
     1415CALLER_OWN char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
    14161416{
    14171417  if(argc != 1)
     
    16441644
    16451645
    1646 G_GNUC_WARN_UNUSED_RESULT char *owl_command_exec(int argc, const char *const *argv, const char *buff)
     1646CALLER_OWN char *owl_command_exec(int argc, const char *const *argv, const char *buff)
    16471647{
    16481648  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN);
    16491649}
    16501650
    1651 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
     1651CALLER_OWN char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
    16521652{
    16531653  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP);
    16541654}
    16551655
    1656 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
     1656CALLER_OWN char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
    16571657{
    16581658  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16591659}
    16601660
    1661 G_GNUC_WARN_UNUSED_RESULT char *owl_command_perl(int argc, const char *const *argv, const char *buff)
     1661CALLER_OWN char *owl_command_perl(int argc, const char *const *argv, const char *buff)
    16621662{
    16631663  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN);
    16641664}
    16651665
    1666 G_GNUC_WARN_UNUSED_RESULT char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
     1666CALLER_OWN char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
    16671667{
    16681668  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP);
    16691669}
    16701670
    1671 G_GNUC_WARN_UNUSED_RESULT char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
     1671CALLER_OWN char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
    16721672{
    16731673  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16741674}
    16751675
    1676 G_GNUC_WARN_UNUSED_RESULT char *owl_command_multi(int argc, const char *const *argv, const char *buff)
     1676CALLER_OWN char *owl_command_multi(int argc, const char *const *argv, const char *buff)
    16771677{
    16781678  char *lastrv = NULL, *newbuff;
     
    25942594}
    25952595
    2596 G_GNUC_WARN_UNUSED_RESULT char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
     2596CALLER_OWN char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
    25972597{
    25982598  const char *stylename;
     
    26372637}
    26382638
    2639 G_GNUC_WARN_UNUSED_RESULT char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
     2639CALLER_OWN char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
    26402640{
    26412641  owl_history *hist;
  • context.c

    rd427f08 r6829afc  
    66
    77/* TODO: dependency from owl_context -> owl_window is annoying. */
    8 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
     8CALLER_OWN owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
    99{
    1010  owl_context *c;
  • dict.c

    rd427f08 r6829afc  
    107107/* Doesn't free the value of the element, but does
    108108 * return it so the caller can free it. */
    109 G_GNUC_WARN_UNUSED_RESULT void *owl_dict_remove_element(owl_dict *d, const char *k)
     109CALLER_OWN void *owl_dict_remove_element(owl_dict *d, const char *k)
    110110{
    111111  int i;
  • editcontext.c

    rd427f08 r6829afc  
    88}
    99
    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)
     10CALLER_OWN owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)
    1111{
    1212  owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap,
  • editwin.c

    rd427f08 r6829afc  
    6161static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len);
    6262static int oe_copy_region(owl_editwin *e);
    63 static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end);
     63static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end);
    6464static void oe_destroy_cbdata(owl_editwin *e);
    6565static void oe_dirty(owl_editwin *e);
     
    7070#define WHITESPACE " \n\t"
    7171
    72 static G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_allocate(void)
     72static CALLER_OWN owl_editwin *owl_editwin_allocate(void)
    7373{
    7474  owl_editwin *e = g_new0(owl_editwin, 1);
     
    142142}
    143143
    144 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
     144CALLER_OWN owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
    145145{
    146146  owl_editwin *e = owl_editwin_allocate();
     
    13691369}
    13701370
    1371 G_GNUC_WARN_UNUSED_RESULT char *owl_editwin_get_region(owl_editwin *e)
     1371CALLER_OWN char *owl_editwin_get_region(owl_editwin *e)
    13721372{
    13731373  int start, end;
     
    13881388}
    13891389
    1390 static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end)
     1390static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end)
    13911391{
    13921392  char *p;
  • filter.c

    rd427f08 r6829afc  
    200200
    201201
    202 char G_GNUC_WARN_UNUSED_RESULT *owl_filter_print(const owl_filter *f)
     202char CALLER_OWN *owl_filter_print(const owl_filter *f)
    203203{
    204204  GString *out = g_string_new("");
  • fmtext.c

    rd427f08 r6829afc  
    171171 * freeing the return
    172172 */
    173 char G_GNUC_WARN_UNUSED_RESULT *owl_fmtext_print_plain(const owl_fmtext *f)
     173char CALLER_OWN *owl_fmtext_print_plain(const owl_fmtext *f)
    174174{
    175175  return owl_strip_format_chars(f->buff->str);
  • functions.c

    rb470451 r6829afc  
    1414#include "filterproc.h"
    1515
    16 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command(const char *cmdbuff)
     16CALLER_OWN char *owl_function_command(const char *cmdbuff)
    1717{
    1818  owl_function_debugmsg("executing command: %s", cmdbuff);
     
    2121}
    2222
    23 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command_argv(const char *const *argv, int argc)
     23CALLER_OWN char *owl_function_command_argv(const char *const *argv, int argc)
    2424{
    2525  return owl_cmddict_execute_argv(owl_global_get_cmddict(&g),
     
    9595}
    9696
    97 G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name)
     97CALLER_OWN char *owl_function_style_describe(const char *name)
    9898{
    9999  const char *desc;
     
    112112}
    113113
    114 G_GNUC_WARN_UNUSED_RESULT char *owl_function_cmd_describe(const char *name)
     114CALLER_OWN char *owl_function_cmd_describe(const char *name)
    115115{
    116116  const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    250250 * owl_global_messagequeue_addmsg() for that.
    251251 */
    252 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
     252CALLER_OWN owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
    253253{
    254254  owl_message *m;
     
    271271 * owl_global_messagequeue_addmsg() for that.
    272272 */
    273 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_loopback(const char *body)
     273CALLER_OWN owl_message *owl_function_make_outgoing_loopback(const char *body)
    274274{
    275275  owl_message *m;
     
    19001900}
    19011901
    1902 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *line)
     1902CALLER_OWN owl_editwin *owl_function_start_question(const char *line)
    19031903{
    19041904  owl_editwin *tw;
     
    19151915}
    19161916
    1917 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *line)
     1917CALLER_OWN owl_editwin *owl_function_start_password(const char *line)
    19181918{
    19191919  owl_editwin *tw;
     
    19321932}
    19331933
    1934 G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
     1934CALLER_OWN char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
    19351935{
    19361936  /* if type == 1 display in a popup
     
    19751975}
    19761976
    1977 G_GNUC_WARN_UNUSED_RESULT char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
     1977CALLER_OWN char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
    19781978{
    19791979  /* if type == 1 display in a popup
     
    21452145 * Returns the name of the negated filter, which the caller must free.
    21462146 */
    2147 G_GNUC_WARN_UNUSED_RESULT char *owl_function_create_negative_filter(const char *filtername)
     2147CALLER_OWN char *owl_function_create_negative_filter(const char *filtername)
    21482148{
    21492149  char *newname;
     
    22422242 * If 'related' is nonzero, encompass unclasses and .d classes as well.
    22432243 */
    2244 G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const char *i, int related)
     2244CALLER_OWN char *owl_function_classinstfilt(const char *c, const char *i, int related)
    22452245{
    22462246  owl_filter *f;
     
    23292329 * the filter, which the caller must free.
    23302330 */
    2331 G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser)
     2331CALLER_OWN char *owl_function_zuserfilt(const char *longuser)
    23322332{
    23332333  owl_filter *f;
     
    23752375 * Returns the name of the filter, which the caller must free.
    23762376 */
    2377 G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user)
     2377CALLER_OWN char *owl_function_aimuserfilt(const char *user)
    23782378{
    23792379  owl_filter *f;
     
    24132413}
    24142414
    2415 G_GNUC_WARN_UNUSED_RESULT char *owl_function_typefilt(const char *type)
     2415CALLER_OWN char *owl_function_typefilt(const char *type)
    24162416{
    24172417  owl_filter *f;
     
    24692469}
    24702470
    2471 static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m)
     2471static CALLER_OWN char *owl_function_smartfilter_cc(const owl_message *m)
    24722472{
    24732473  const char *ccs;
     
    25212521 *    name to the AIM conversation with that user
    25222522 */
    2523 G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter(int type, int invert_related)
     2523CALLER_OWN char *owl_function_smartfilter(int type, int invert_related)
    25242524{
    25252525  const owl_view *v;
     
    28602860}
    28612861
    2862 G_GNUC_WARN_UNUSED_RESULT char *owl_function_keymap_summary(const char *name)
     2862CALLER_OWN char *owl_function_keymap_summary(const char *name)
    28632863{
    28642864  const owl_keymap *km
     
    29742974/* strips formatting from ztext and returns the unformatted text.
    29752975 * caller is responsible for freeing. */
    2976 G_GNUC_WARN_UNUSED_RESULT char *owl_function_ztext_stylestrip(const char *zt)
     2976CALLER_OWN char *owl_function_ztext_stylestrip(const char *zt)
    29772977{
    29782978  owl_fmtext fm;
  • global.c

    r43744ce r6829afc  
    172172/* Pops the current context from the context stack and returns it. Caller is
    173173 * responsible for freeing. */
    174 G_GNUC_WARN_UNUSED_RESULT owl_context *owl_global_pop_context_no_delete(owl_global *g)
     174CALLER_OWN owl_context *owl_global_pop_context_no_delete(owl_global *g)
    175175{
    176176  owl_context *c;
     
    725725 * necessary.
    726726 */
    727 owl_message G_GNUC_WARN_UNUSED_RESULT *owl_global_messagequeue_popmsg(owl_global *g)
     727owl_message CALLER_OWN *owl_global_messagequeue_popmsg(owl_global *g)
    728728{
    729729  owl_message *out;
  • keybinding.c

    rd427f08 r6829afc  
    1414
    1515/* sets up a new keybinding for a command */
    16 G_GNUC_WARN_UNUSED_RESULT owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
     16CALLER_OWN owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    1717{
    1818  owl_keybinding *kb = g_new(owl_keybinding, 1);
     
    8585}
    8686
    87 G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_stack_tostring(int *j, int len)
     87CALLER_OWN char *owl_keybinding_stack_tostring(int *j, int len)
    8888{
    8989  GString *string;
     
    100100}
    101101
    102 G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_tostring(const owl_keybinding *kb)
     102CALLER_OWN char *owl_keybinding_tostring(const owl_keybinding *kb)
    103103{
    104104  return owl_keybinding_stack_tostring(kb->keys, kb->len);
  • keymap.c

    rd427f08 r6829afc  
    8080
    8181/* returns a summary line describing this keymap.  the caller must free. */
    82 G_GNUC_WARN_UNUSED_RESULT char *owl_keymap_summary(const owl_keymap *km)
     82CALLER_OWN char *owl_keymap_summary(const owl_keymap *km)
    8383{
    8484  if (!km || !km->name || !km->desc) return NULL;
  • keypress.c

    rd427f08 r6829afc  
    129129/* OWL_META is definied in owl.h */
    130130
    131 char G_GNUC_WARN_UNUSED_RESULT *owl_keypress_tostring(int j, int esc)
     131char CALLER_OWN *owl_keypress_tostring(int j, int esc)
    132132{
    133133  GString *kb;
  • logging.c

    rd427f08 r6829afc  
    8080}
    8181
    82 G_GNUC_WARN_UNUSED_RESULT char *owl_log_zephyr(const owl_message *m)
     82CALLER_OWN char *owl_log_zephyr(const owl_message *m)
    8383{
    8484    char *tmp = NULL;
     
    104104}
    105105
    106 G_GNUC_WARN_UNUSED_RESULT char *owl_log_aim(const owl_message *m)
     106CALLER_OWN char *owl_log_aim(const owl_message *m)
    107107{
    108108    GString *buffer = NULL;
     
    122122}
    123123
    124 G_GNUC_WARN_UNUSED_RESULT char *owl_log_jabber(const owl_message *m)
     124CALLER_OWN char *owl_log_jabber(const owl_message *m)
    125125{
    126126    GString *buffer = NULL;
     
    135135}
    136136
    137 G_GNUC_WARN_UNUSED_RESULT char *owl_log_generic(const owl_message *m)
     137CALLER_OWN char *owl_log_generic(const owl_message *m)
    138138{
    139139    GString *buffer;
  • message.c

    rd427f08 r6829afc  
    580580
    581581/* caller must free return value. */
    582 G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m)
     582CALLER_OWN char *owl_message_get_cc(const owl_message *m)
    583583{
    584584  const char *cur;
     
    597597
    598598/* caller must free return value */
    599 G_GNUC_WARN_UNUSED_RESULT GList *owl_message_get_cc_without_recipient(const owl_message *m)
     599CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m)
    600600{
    601601  char *cc, *shortuser, *recip;
  • owl.h

    r95b52d1 r6829afc  
    199199#define OWL_ENABLE_ZCRYPT 1
    200200#endif
     201
     202/* Annotate functions in which the caller owns the return value and is
     203 * responsible for ensuring it is freed. */
     204#define CALLER_OWN G_GNUC_WARN_UNUSED_RESULT
    201205
    202206#define OWL_META(key) ((key)|010000)
     
    251255                                 * WARNING:  this approach is hard to make
    252256                                 * thread-safe... */
    253   char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
     257  char CALLER_OWN *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
    254258                                /* converts val to a string;
    255259                                 * caller must free the result */
     
    313317 
    314318  /* These don't take any context */
    315   char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
     319  char CALLER_OWN *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
    316320                                /* takes argv and the full command as buff.
    317321                                 * caller must free return value if !NULL */
     
    320324
    321325  /* The following also take the active context if it's valid */
    322   char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
     326  char CALLER_OWN *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
    323327                                /* takes argv and the full command as buff.
    324328                                 * caller must free return value if !NULL */
  • perlconfig.c

    rd427f08 r6829afc  
    2323
    2424
    25 G_GNUC_WARN_UNUSED_RESULT SV *owl_new_sv(const char * str)
     25CALLER_OWN SV *owl_new_sv(const char * str)
    2626{
    2727  SV *ret = newSVpv(str, 0);
     
    3636}
    3737
    38 G_GNUC_WARN_UNUSED_RESULT AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
     38CALLER_OWN AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
    3939{
    4040  AV *ret;
     
    5252}
    5353
    54 G_GNUC_WARN_UNUSED_RESULT HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
     54CALLER_OWN HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
    5555{
    5656  HV *ret;
     
    7575}
    7676
    77 G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_message2hashref(const owl_message *m)
     77CALLER_OWN SV *owl_perlconfig_message2hashref(const owl_message *m)
    7878{
    7979  HV *h, *stash;
     
    165165}
    166166
    167 G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_curmessage2hashref(void)
     167CALLER_OWN SV *owl_perlconfig_curmessage2hashref(void)
    168168{
    169169  int curmsg;
     
    183183   This has been somewhat addressed, but is still not lossless.
    184184 */
    185 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_perlconfig_hashref2message(SV *msg)
     185CALLER_OWN owl_message *owl_perlconfig_hashref2message(SV *msg)
    186186{
    187187  owl_message * m;
     
    251251/* Calls in a scalar context, passing it a hash reference.
    252252   If return value is non-null, caller must free. */
    253 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
     253CALLER_OWN char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
    254254{
    255255  dSP ;
     
    300300   If the return value is non-null, the caller must free it.
    301301 */
    302 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
     302CALLER_OWN char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
    303303{
    304304  dSP;
     
    350350
    351351/* 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)
     352CALLER_OWN char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv)
    353353{
    354354  int ret;
     
    436436
    437437/* caller is responsible for freeing returned string */
    438 G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line)
     438CALLER_OWN char *owl_perlconfig_execute(const char *line)
    439439{
    440440  STRLEN len;
     
    506506
    507507/* 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)
     508CALLER_OWN char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
    509509{
    510510  int i, count;
  • popwin.c

    rd427f08 r6829afc  
    11#include "owl.h"
    22
    3 G_GNUC_WARN_UNUSED_RESULT owl_popwin *owl_popwin_new(void)
     3CALLER_OWN owl_popwin *owl_popwin_new(void)
    44{
    55  owl_popwin *pw = g_new0(owl_popwin, 1);
  • text.c

    rd427f08 r6829afc  
    77/* Returns a copy of 'in' with each line indented 'n'
    88 * characters. Result must be freed with g_free. */
    9 G_GNUC_WARN_UNUSED_RESULT char *owl_text_indent(const char *in, int n)
     9CALLER_OWN char *owl_text_indent(const char *in, int n)
    1010{
    1111  const char *ptr1, *ptr2, *last;
     
    4848
    4949/* caller must free the return */
    50 G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in)
     50CALLER_OWN char *owl_text_htmlstrip(const char *in)
    5151{
    5252  const char *ptr1, *end, *ptr2, *ptr3;
     
    129129
    130130/* Caller must free return */
    131 G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in)
     131CALLER_OWN char *owl_text_expand_tabs(const char *in)
    132132{
    133133  int len = 0;
     
    188188
    189189/* caller must free the return */
    190 G_GNUC_WARN_UNUSED_RESULT char *owl_text_wordwrap(const char *in, int col)
     190CALLER_OWN char *owl_text_wordwrap(const char *in, int col)
    191191{
    192192  char *out;
     
    269269 * Caller must free returned string.
    270270 */
    271 G_GNUC_WARN_UNUSED_RESULT char *owl_text_substitute(const char *in, const char *from, const char *to)
     271CALLER_OWN char *owl_text_substitute(const char *in, const char *from, const char *to)
    272272{
    273273  char **split = g_strsplit(in, from, 0), *out;
     
    284284 * On success returns the string, on error returns NULL.
    285285 */
    286 G_GNUC_WARN_UNUSED_RESULT char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
     286CALLER_OWN char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
    287287{
    288288  int i, x, r, place, escape;
  • util.c

    rd427f08 r6829afc  
    3535 * duplicate slashes are removed.  Caller must free the return.
    3636 */
    37 G_GNUC_WARN_UNUSED_RESULT char *owl_util_makepath(const char *in)
     37CALLER_OWN char *owl_util_makepath(const char *in)
    3838{
    3939  int i, j, x;
     
    102102   to -1, argv will be NULL and the caller does not need to free anything. The
    103103   returned vector is NULL-terminated. */
    104 G_GNUC_WARN_UNUSED_RESULT char **owl_parseline(const char *line, int *argc)
     104CALLER_OWN char **owl_parseline(const char *line, int *argc)
    105105{
    106106  GPtrArray *argv;
     
    245245}
    246246
    247 G_GNUC_WARN_UNUSED_RESULT char *owl_string_build_quoted(const char *tmpl, ...)
     247CALLER_OWN char *owl_string_build_quoted(const char *tmpl, ...)
    248248{
    249249  GString *buf = g_string_new("");
     
    257257/* Returns a quoted version of arg suitable for placing in a
    258258 * command-line. Result should be freed with g_free. */
    259 G_GNUC_WARN_UNUSED_RESULT char *owl_arg_quote(const char *arg)
     259CALLER_OWN char *owl_arg_quote(const char *arg)
    260260{
    261261  GString *buf = g_string_new("");;
     
    265265
    266266/* caller must free the return */
    267 G_GNUC_WARN_UNUSED_RESULT char *owl_util_minutes_to_timestr(int in)
     267CALLER_OWN char *owl_util_minutes_to_timestr(int in)
    268268{
    269269  int days, hours;
     
    331331
    332332/* Get the default tty name.  Caller must free the return */
    333 G_GNUC_WARN_UNUSED_RESULT char *owl_util_get_default_tty(void)
     333CALLER_OWN char *owl_util_get_default_tty(void)
    334334{
    335335  const char *tmp;
     
    353353 * return.
    354354 */
    355 G_GNUC_WARN_UNUSED_RESULT char *owl_util_stripnewlines(const char *in)
     355CALLER_OWN char *owl_util_stripnewlines(const char *in)
    356356{
    357357 
     
    384384 * Error conditions are the same as g_file_read_link.
    385385 */
    386 G_GNUC_WARN_UNUSED_RESULT gchar *owl_util_recursive_resolve_link(const char *filename)
     386CALLER_OWN gchar *owl_util_recursive_resolve_link(const char *filename)
    387387{
    388388  gchar *last_path = g_strdup(filename);
     
    511511   The caller is responsible for freeing the allocated string.
    512512*/
    513 G_GNUC_WARN_UNUSED_RESULT char *owl_util_baseclass(const char *class)
     513CALLER_OWN char *owl_util_baseclass(const char *class)
    514514{
    515515  char *start, *end;
     
    547547/* Strips format characters from a valid utf-8 string. Returns the
    548548   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)
     549CALLER_OWN char *owl_strip_format_chars(const char *in)
    550550{
    551551  char *r;
     
    586586 * Caller must free the return.
    587587 */
    588 G_GNUC_WARN_UNUSED_RESULT char *owl_validate_or_convert(const char *in)
     588CALLER_OWN char *owl_validate_or_convert(const char *in)
    589589{
    590590  if (g_utf8_validate(in, -1, NULL)) {
     
    602602 * Caller must free the return.
    603603 */
    604 G_GNUC_WARN_UNUSED_RESULT char *owl_validate_utf8(const char *in)
     604CALLER_OWN char *owl_validate_utf8(const char *in)
    605605{
    606606  char *out;
     
    635635
    636636/* caller must free the return */
    637 G_GNUC_WARN_UNUSED_RESULT char *owl_escape_highbit(const char *str)
     637CALLER_OWN char *owl_escape_highbit(const char *str)
    638638{
    639639  GString *out = g_string_new("");
     
    698698
    699699/* Read the rest of the input available in fp into a string. */
    700 G_GNUC_WARN_UNUSED_RESULT char *owl_slurp(FILE *fp)
     700CALLER_OWN char *owl_slurp(FILE *fp)
    701701{
    702702  char *buf = NULL;
  • variable.c

    rd427f08 r6829afc  
    646646}
    647647
    648 G_GNUC_WARN_UNUSED_RESULT owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description)
     648CALLER_OWN owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description)
    649649{
    650650  owl_variable * var = g_new0(owl_variable, 1);
     
    825825}
    826826
    827 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d, const char *name)
     827CALLER_OWN char *owl_variable_get_tostring(const owl_vardict *d, const char *name)
    828828{
    829829  owl_variable *v;
     
    834834}
    835835
    836 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name)
     836CALLER_OWN char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name)
    837837{
    838838  owl_variable *v;
     
    995995}
    996996
    997 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val)
     997CALLER_OWN char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val)
    998998{
    999999  if (val == NULL) {
     
    10311031}
    10321032
    1033 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val)
     1033CALLER_OWN char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val)
    10341034{
    10351035  if (val == NULL) {
     
    10711071}
    10721072
    1073 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val)
     1073CALLER_OWN char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val)
    10741074{
    10751075  char **enums;
     
    11121112}
    11131113
    1114 G_GNUC_WARN_UNUSED_RESULT char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
     1114CALLER_OWN char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
    11151115{
    11161116  if (val == NULL) {
  • viewwin.c

    rd427f08 r6829afc  
    1212 * will be used by the viewwin
    1313 */
    14 G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
     14CALLER_OWN owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
    1515{
    1616  owl_viewwin *v = g_new0(owl_viewwin, 1);
     
    3434 * will be used by the viewwin
    3535 */
    36 G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
     36CALLER_OWN owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
    3737{
    3838  char *text;
     
    237237}
    238238
    239 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
     239CALLER_OWN owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
    240240  int lines, cols;
    241241  owl_editwin *cmdline;
  • window.c

    rd427f08 r6829afc  
    569569};
    570570
    571 G_GNUC_WARN_UNUSED_RESULT GSource *owl_window_redraw_source_new(void)
     571CALLER_OWN GSource *owl_window_redraw_source_new(void)
    572572{
    573573  GSource *source;
  • zcrypt.c

    rd427f08 r6829afc  
    2727#include "filterproc.h"
    2828
     29/* Annotate functions in which the caller owns the return value and is
     30 * responsible for ensuring it is freed. */
     31#define CALLER_OWN G_GNUC_WARN_UNUSED_RESULT
     32
    2933#define MAX_KEY      128
    3034#define MAX_LINE     128
     
    5357} ZWRITEOPTIONS;
    5458
    55 G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
     59CALLER_OWN char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
    5660int ParseCryptSpec(const char *spec, 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);
     61CALLER_OWN char *BuildArgString(char **argv, int start, int end);
     62CALLER_OWN char *read_keystring(const char *keyfile);
    5963
    6064int do_encrypt(int zephyr, const char *class, const char *instance,
     
    364368/* Build a space-separated string from argv from elements between start  *
    365369 * and end - 1.  malloc()'s the returned string. */
    366 G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end)
     370CALLER_OWN char *BuildArgString(char **argv, int start, int end)
    367371{
    368372  int len = 1;
     
    401405#define MAX_SEARCH 3
    402406/* Find the class/instance in the .crypt-table */
    403 G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
     407CALLER_OWN char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
    404408{
    405409  char *keyfile = NULL;
     
    579583}
    580584
    581 G_GNUC_WARN_UNUSED_RESULT char *slurp_stdin(int ignoredot, int *length) {
     585CALLER_OWN char *slurp_stdin(int ignoredot, int *length) {
    582586  char *buf;
    583587  char *inptr;
     
    611615}
    612616
    613 G_GNUC_WARN_UNUSED_RESULT char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
     617CALLER_OWN char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
    614618  char *buf;
    615619
     
    637641}
    638642
    639 G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile) {
     643CALLER_OWN char *read_keystring(const char *keyfile) {
    640644  char *keystring;
    641645  FILE *fkey = fopen(keyfile, "r");
  • zephyr.c

    rd427f08 r6829afc  
    524524 */
    525525#ifdef HAVE_LIBZEPHYR
    526 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
     526CALLER_OWN char *owl_zephyr_get_field(const ZNotice_t *n, int j)
    527527{
    528528  int i, count, save;
     
    552552}
    553553
    554 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
     554CALLER_OWN char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
    555555{
    556556  int i, count, save;
     
    584584}
    585585#else
    586 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j)
     586CALLER_OWN char *owl_zephyr_get_field(void *n, int j)
    587587{
    588588  return(g_strdup(""));
    589589}
    590 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j)
     590CALLER_OWN char *owl_zephyr_get_field_as_utf8(void *n, int j)
    591591{
    592592  return owl_zephyr_get_field(n, j);
     
    621621 * caller must free the return
    622622 */
    623 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
     623CALLER_OWN char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
    624624{
    625625#define OWL_NFIELDS     5
     
    942942#endif
    943943
    944 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth)
     944CALLER_OWN char *owl_zephyr_zlocate(const char *user, int auth)
    945945{
    946946#ifdef HAVE_LIBZEPHYR
     
    10421042
    10431043/* caller must free the return */
    1044 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
     1044CALLER_OWN char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
    10451045{
    10461046  return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip);
     
    11221122 * free the return.
    11231123 */
    1124 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void)
     1124CALLER_OWN char *owl_zephyr_getsubs(void)
    11251125{
    11261126#ifdef HAVE_LIBZEPHYR
     
    12421242 * The caller must free the return
    12431243 */
    1244 G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
     1244CALLER_OWN char *short_zuser(const char *in)
    12451245{
    12461246  char *ptr = strrchr(in, '@');
     
    12541254 * The caller must free the return.
    12551255 */
    1256 G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in)
     1256CALLER_OWN char *long_zuser(const char *in)
    12571257{
    12581258  char *ptr = strrchr(in, '@');
     
    12821282 * caller must free the return.
    12831283 */
    1284 G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in)
     1284CALLER_OWN char *owl_zephyr_smartstripped_user(const char *in)
    12851285{
    12861286  char *slash, *dot, *realm, *out;
  • zwrite.c

    rd427f08 r6829afc  
    55#include "owl.h"
    66
    7 G_GNUC_WARN_UNUSED_RESULT owl_zwrite *owl_zwrite_new(const char *line)
     7CALLER_OWN owl_zwrite *owl_zwrite_new(const char *line)
    88{
    99  owl_zwrite *z = g_new(owl_zwrite, 1);
     
    321321
    322322/* Caller must free the result. */
    323 G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
     323CALLER_OWN char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
    324324{
    325325  if (z->realm[0]) {
     
    370370 * If not a CC, only the recip_index'th user will be replied to.
    371371 */
    372 G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
     372CALLER_OWN char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
    373373{
    374374  /* Match ordering in zwrite help. */
Note: See TracChangeset for help on using the changeset viewer.