Changeset d427f08 for owl.h


Ignore:
Timestamp:
Jun 22, 2011, 3:40:50 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
b343c2c
Parents:
84a071f
git-author:
Jason Gross <jgross@mit.edu> (06/06/11 05:24:30)
git-committer:
Nelson Elhage <nelhage@mit.edu> (06/22/11 15:40:50)
Message:
Use G_GNUC_WARN_UNUSED_RESULT

Have gcc warn us when we ignore the result of a function that requires
the caller to free the result, or an initilization function that can
fail.  This might help (slightly) with preventing leaks and segfaults.

Additionally changed some functions that should never fail to not
return values.  (The owl_list_* functions changed only fail if
list->size < 0, which we assume is not the case elsewhere.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    raa69c1e rd427f08  
    251251                                 * WARNING:  this approach is hard to make
    252252                                 * thread-safe... */
    253   char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
     253  char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
    254254                                /* converts val to a string;
    255255                                 * caller must free the result */
     
    313313 
    314314  /* These don't take any context */
    315   char *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff); 
     315  char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
    316316                                /* takes argv and the full command as buff.
    317317                                 * caller must free return value if !NULL */
     
    320320
    321321  /* The following also take the active context if it's valid */
    322   char *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff); 
     322  char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
    323323                                /* takes argv and the full command as buff.
    324324                                 * caller must free return value if !NULL */
Note: See TracChangeset for help on using the changeset viewer.