diff options
-rw-r--r-- | libcrystfel/src/utils.c | 7 | ||||
-rw-r--r-- | libcrystfel/src/utils.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c index de1dc2f4..0c01c069 100644 --- a/libcrystfel/src/utils.c +++ b/libcrystfel/src/utils.c @@ -503,6 +503,13 @@ char *check_prefix(char *prefix) } +char *safe_strdup(const char *in) +{ + if ( in == NULL ) return NULL; + return strdup(in); +} + + char *safe_basename(const char *in) { int i; diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h index b2694f2a..f406ef6c 100644 --- a/libcrystfel/src/utils.h +++ b/libcrystfel/src/utils.h @@ -222,6 +222,7 @@ extern pthread_mutex_t stderr_lock; extern char *check_prefix(char *prefix); extern char *safe_basename(const char *in); +extern char *safe_strdup(const char *in); extern void strip_extension(char *bfn); extern char *load_entire_file(const char *filename); |