diff options
author | Petr Machata <pmachata@redhat.com> | 2013-01-07 18:09:32 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2013-03-08 22:55:31 +0100 |
commit | b1ab2aefa199ea8e14e29bac78ae71030c2d4863 (patch) | |
tree | daf37ac44f5b412fc2788708abf1effcf721b7df /common.h | |
parent | 395a4e3ad6b03949fbe0a2818bfdec738da1c281 (diff) | |
download | ltrace-b1ab2aefa199ea8e14e29bac78ae71030c2d4863.tar.gz |
Consolidate two duplicate conditional strdup wrappers to strdup_if
- Convert callers in prototype.c and library.c
- Current placement in library.c is somewhat arbitrary. There
currently doesn't seem to be a more suitable place.
- The behavior subtly changed: in case of failure, RET is now
unaffected.
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* * This file is part of ltrace. - * Copyright (C) 2011,2012 Petr Machata, Red Hat Inc. + * Copyright (C) 2011,2012,2013 Petr Machata, Red Hat Inc. * Copyright (C) 2010 Joe Damato * Copyright (C) 2009 Juan Cespedes * @@ -66,4 +66,9 @@ struct library_symbol; int format_argument(FILE *stream, struct value *value, struct value_dict *arguments); +/* Set *RET to either a duplicate of STR (if WHETHER), or STR + * (otherwise). Return 0 on success or a negative value on failure. + * The duplication is not done if STR is NULL. */ +int strdup_if(const char **ret, const char *str, int whether); + #endif |