1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work.
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
11 /* Concatenate path and filename to new allocated buffer.
12 * Add '/' only as needed (no duplicate // are produced).
13 * If path is NULL, it is assumed to be "/".
14 * filename should not be NULL.
19 char* FAST_FUNC concat_path_file(const char *path, const char *filename)
25 lc = last_char_is(path, '/');
26 while (*filename == '/')
28 return xasprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename);