Changeset 6829afc for util.c


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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.