Changeset 7dfe886 for text.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
  • text.c

    r7865479 r7dfe886  
    77/* Returns a copy of 'in' with each line indented 'n'
    88 * characters. Result must be freed with g_free. */
    9 char *owl_text_indent(const char *in, int n)
     9G_GNUC_WARN_UNUSED_RESULT char *owl_text_indent(const char *in, int n)
    1010{
    1111  const char *ptr1, *ptr2, *last;
     
    4848
    4949/* caller must free the return */
    50 char *owl_text_htmlstrip(const char *in)
     50G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in)
    5151{
    5252  const char *ptr1, *end, *ptr2, *ptr3;
     
    129129
    130130/* Caller must free return */
    131 char *owl_text_expand_tabs(const char *in)
     131G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in)
    132132{
    133133  int len = 0;
     
    188188
    189189/* caller must free the return */
    190 char *owl_text_wordwrap(const char *in, int col)
     190G_GNUC_WARN_UNUSED_RESULT char *owl_text_wordwrap(const char *in, int col)
    191191{
    192192  char *out;
     
    269269 * Caller must free returned string.
    270270 */
    271 char *owl_text_substitute(const char *in, const char *from, const char *to)
     271G_GNUC_WARN_UNUSED_RESULT 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 char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
     286G_GNUC_WARN_UNUSED_RESULT char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
    287287{
    288288  int i, x, r, place, escape;
Note: See TracChangeset for help on using the changeset viewer.