Changeset d427f08 for zephyr.c


Ignore:
Timestamp:
Jun 22, 2011, 3:40:50 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, 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
  • zephyr.c

    re146cd7 rd427f08  
    524524 */
    525525#ifdef HAVE_LIBZEPHYR
    526 char *owl_zephyr_get_field(const ZNotice_t *n, int j)
     526G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
    527527{
    528528  int i, count, save;
     
    552552}
    553553
    554 char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
     554G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
    555555{
    556556  int i, count, save;
     
    584584}
    585585#else
    586 char *owl_zephyr_get_field(void *n, int j)
     586G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j)
    587587{
    588588  return(g_strdup(""));
    589589}
    590 char *owl_zephyr_get_field_as_utf8(void *n, int j)
     590G_GNUC_WARN_UNUSED_RESULT 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 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
     623G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
    624624{
    625625#define OWL_NFIELDS     5
     
    942942#endif
    943943
    944 char *owl_zephyr_zlocate(const char *user, int auth)
     944G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth)
    945945{
    946946#ifdef HAVE_LIBZEPHYR
     
    10421042
    10431043/* caller must free the return */
    1044 char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
     1044G_GNUC_WARN_UNUSED_RESULT 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 char *owl_zephyr_getsubs(void)
     1124G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void)
    11251125{
    11261126#ifdef HAVE_LIBZEPHYR
     
    12421242 * The caller must free the return
    12431243 */
    1244 char *short_zuser(const char *in)
     1244G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
    12451245{
    12461246  char *ptr = strrchr(in, '@');
     
    12541254 * The caller must free the return.
    12551255 */
    1256 char *long_zuser(const char *in)
     1256G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in)
    12571257{
    12581258  char *ptr = strrchr(in, '@');
     
    12821282 * caller must free the return.
    12831283 */
    1284 char *owl_zephyr_smartstripped_user(const char *in)
     1284G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in)
    12851285{
    12861286  char *slash, *dot, *realm, *out;
Note: See TracChangeset for help on using the changeset viewer.