summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-08-18 00:38:55 +0200
committerBert <ber.t@gmx.com>2011-08-18 00:38:55 +0200
commitff013dd0092df247b2c9f1c550e03542581ed21d (patch)
tree572777f9576c65c63a6f520e3b8b5b85edf5d580 /util.c
parent2a3a9657d360a4952ef84aa4e8665f211d490321 (diff)
downloadnsxiv-ff013dd0092df247b2c9f1c550e03542581ed21d.tar.zst
Revised handling of file names & paths
Diffstat (limited to 'util.c')
-rw-r--r--util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/util.c b/util.c
index dee497d..e8bbdd9 100644
--- a/util.c
+++ b/util.c
@@ -47,6 +47,17 @@ void* s_realloc(void *ptr, size_t size) {
return ptr;
}
+char* s_strdup(char *s) {
+ char *d = NULL;
+
+ if (s) {
+ if (!(d = malloc(strlen(s) + 1)))
+ die("could not allocate memory");
+ strcpy(d, s);
+ }
+ return d;
+}
+
void warn(const char* fmt, ...) {
va_list args;