diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-05-28 16:08:46 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-05-28 16:08:46 +0100 |
commit | c105738fa36bb2400adc47399c5b878d252d1c86 (patch) | |
tree | 138eeb449e1bf51ee1726b5f820740aada0ccd0b /utils/filename.c | |
parent | 20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff) | |
download | netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2 |
Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all
callsites to have double bracketing and allows for future improvement
on how we use the logging macros.
The callsites were changed with coccinelle and the changes checked by
hand. Compile tested for several frontends but not all.
A formatting annotation has also been added which allows the compiler
to check the parameters and types passed to the logging.
Diffstat (limited to 'utils/filename.c')
-rw-r--r-- | utils/filename.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/utils/filename.c b/utils/filename.c index 5efd56177..19ee03968 100644 --- a/utils/filename.c +++ b/utils/filename.c @@ -85,7 +85,7 @@ const char *filename_request(void) /* no available slots - create a new directory */ dir = filename_create_directory(NULL); if (dir == NULL) { - LOG(("Failed to create a new directory.")); + LOG("Failed to create a new directory."); return NULL; } i = 63; @@ -183,11 +183,10 @@ bool filename_initialise(void) for (start = directory; *start != '\0'; start++) { if (*start == '/') { *start = '\0'; - LOG(("Creating \"%s\"", directory)); + LOG("Creating \"%s\"", directory); ret = nsmkdir(directory, S_IRWXU); if (ret != 0 && errno != EEXIST) { - LOG(("Failed to create directory \"%s\"", - directory)); + LOG("Failed to create directory \"%s\"", directory); free(directory); return false; } @@ -196,7 +195,7 @@ bool filename_initialise(void) } } - LOG(("Temporary directory location: %s", directory)); + LOG("Temporary directory location: %s", directory); ret = nsmkdir(directory, S_IRWXU); free(directory); @@ -282,7 +281,7 @@ bool filename_flush_directory(const char *folder, int depth) child[sizeof(child) - 1] = '\0'; if (stat(child, &statbuf) == -1) { - LOG(("Unable to stat %s: %s", child, strerror(errno))); + LOG("Unable to stat %s: %s", child, strerror(errno)); continue; } @@ -350,7 +349,7 @@ bool filename_flush_directory(const char *folder, int depth) filename_delete_recursive(child); if (remove(child)) - LOG(("Failed to remove '%s'", child)); + LOG("Failed to remove '%s'", child); else changed = true; } else { @@ -389,7 +388,7 @@ bool filename_delete_recursive(char *folder) child[sizeof(child) - 1] = '\0'; if (stat(child, &statbuf) == -1) { - LOG(("Unable to stat %s: %s", child, strerror(errno))); + LOG("Unable to stat %s: %s", child, strerror(errno)); continue; } @@ -401,7 +400,7 @@ bool filename_delete_recursive(char *folder) } if (remove(child)) { - LOG(("Failed to remove '%s'", child)); + LOG("Failed to remove '%s'", child); closedir(parent); return false; } @@ -467,7 +466,7 @@ static struct directory *filename_create_directory(const char *prefix) /* allocate a new directory */ new_dir = malloc(sizeof(struct directory)); if (new_dir == NULL) { - LOG(("No memory for malloc()")); + LOG("No memory for malloc()"); return NULL; } @@ -501,8 +500,7 @@ static struct directory *filename_create_directory(const char *prefix) * whilst we are running if there is an error, so we * don't report this yet and try to create the * structure normally. */ - LOG(("Failed to create optimised structure '%s'", - filename_directory)); + LOG("Failed to create optimised structure '%s'", filename_directory); } } @@ -522,8 +520,7 @@ static struct directory *filename_create_directory(const char *prefix) if (!is_dir(filename_directory)) { if (nsmkdir(filename_directory, S_IRWXU)) { - LOG(("Failed to create directory '%s'", - filename_directory)); + LOG("Failed to create directory '%s'", filename_directory); return NULL; } } |