Changeset 7dfe886 for zephyr.c


Ignore:
Timestamp:
Jun 19, 2011, 2:44:13 AM (13 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
b0e6560
Parents:
9d43dcc
git-author:
Jason Gross <jgross@mit.edu> (06/06/11 05:24:30)
git-committer:
Jason Gross <jgross@mit.edu> (06/19/11 02:44:13)
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
  • zephyr.c

    rb848e30 r7dfe886  
    521521 */
    522522#ifdef HAVE_LIBZEPHYR
    523 char *owl_zephyr_get_field(const ZNotice_t *n, int j)
     523G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
    524524{
    525525  int i, count, save;
     
    549549}
    550550
    551 char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
     551G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
    552552{
    553553  int i, count, save;
     
    581581}
    582582#else
    583 char *owl_zephyr_get_field(void *n, int j)
     583G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j)
    584584{
    585585  return(g_strdup(""));
    586586}
    587 char *owl_zephyr_get_field_as_utf8(void *n, int j)
     587G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j)
    588588{
    589589  return owl_zephyr_get_field(n, j);
     
    618618 * caller must free the return
    619619 */
    620 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
     620G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
    621621{
    622622#define OWL_NFIELDS     5
     
    939939#endif
    940940
    941 char *owl_zephyr_zlocate(const char *user, int auth)
     941G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth)
    942942{
    943943#ifdef HAVE_LIBZEPHYR
     
    10391039
    10401040/* caller must free the return */
    1041 char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
     1041G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
    10421042{
    10431043  return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip);
     
    11191119 * free the return.
    11201120 */
    1121 char *owl_zephyr_getsubs(void)
     1121G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void)
    11221122{
    11231123#ifdef HAVE_LIBZEPHYR
     
    12391239 * The caller must free the return
    12401240 */
    1241 char *short_zuser(const char *in)
     1241G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
    12421242{
    12431243  char *ptr = strrchr(in, '@');
     
    12511251 * The caller must free the return.
    12521252 */
    1253 char *long_zuser(const char *in)
     1253G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in)
    12541254{
    12551255  char *ptr = strrchr(in, '@');
     
    12791279 * caller must free the return.
    12801280 */
    1281 char *owl_zephyr_smartstripped_user(const char *in)
     1281G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in)
    12821282{
    12831283  char *slash, *dot, *realm, *out;
Note: See TracChangeset for help on using the changeset viewer.