From c56642819eed87431dff3446fe111f7f3eefaa7d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 7 May 2014 16:14:18 +0100 Subject: add file operations table and make all frontends use it. This rationalises the path construction and basename file operations. The default implementation is POSIX which works for all frontends except windows, riscos and amiga which have differeing path separators and rules. These implementations are significantly more robust than the previous nine implementations and also do not use unsafe strncpy or buffers with arbitrary length limits. These implementations also carry full documentation comments. --- utils/filepath.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'utils/filepath.c') diff --git a/utils/filepath.c b/utils/filepath.c index 68e8d7e79..c28a821d7 100644 --- a/utils/filepath.c +++ b/utils/filepath.c @@ -325,25 +325,6 @@ void filepath_free_strvec(char **pathv) free(pathv); } -/* exported interface documented in filepath.h */ -char *filepath_append(const char *path, const char *leaf) -{ - int dirname_len; - char *dirname; - - if ((path == NULL) || (leaf == NULL)) { - return NULL; - } - - dirname_len = strlen(path) + strlen(leaf) + 2; - dirname = malloc(dirname_len); - if (dirname != NULL) { - snprintf(dirname, dirname_len, "%s/%s", path, leaf); - } - - return dirname; -} - /* exported interface documented in filepath.h */ nserror filepath_mkdir_all(const char *fname) { -- cgit v1.2.3