summaryrefslogtreecommitdiff
path: root/utils/filename.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-09-06 18:28:12 +0100
committerVincent Sanders <vince@kyllikki.org>2017-09-06 18:45:27 +0100
commit75018632a9b953aafeae6f4e8aea607fd1d89dca (patch)
treed661d2fded2ad4b80c4cf019dee2954c052ab090 /utils/filename.c
parent8d9b2efc11529da8cb5870b39ff15249c648b10a (diff)
downloadnetsurf-75018632a9b953aafeae6f4e8aea607fd1d89dca.tar.gz
netsurf-75018632a9b953aafeae6f4e8aea607fd1d89dca.tar.bz2
Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done @@ expression E; @@ -LOG(E); +NSLOG(netsurf, INFO, E); @@ expression E, E1; @@ -LOG(E, E1); +NSLOG(netsurf, INFO, E, E1); @@ expression E, E1, E2; @@ -LOG(E, E1, E2); +NSLOG(netsurf, INFO, E, E1, E2); @@ expression E, E1, E2, E3; @@ -LOG(E, E1, E2, E3); +NSLOG(netsurf, INFO, E, E1, E2, E3); @@ expression E, E1, E2, E3, E4; @@ -LOG(E, E1, E2, E3, E4); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4); @@ expression E, E1, E2, E3, E4, E5; @@ -LOG(E, E1, E2, E3, E4, E5); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5); @@ expression E, E1, E2, E3, E4, E5, E6; @@ -LOG(E, E1, E2, E3, E4, E5, E6); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6); @@ expression E, E1, E2, E3, E4, E5, E6, E7; @@ -LOG(E, E1, E2, E3, E4, E5, E6, E7); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
Diffstat (limited to 'utils/filename.c')
-rw-r--r--utils/filename.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/utils/filename.c b/utils/filename.c
index 9c95901a1..01a403fd9 100644
--- a/utils/filename.c
+++ b/utils/filename.c
@@ -84,7 +84,8 @@ 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.");
+ NSLOG(netsurf, INFO,
+ "Failed to create a new directory.");
return NULL;
}
i = 63;
@@ -182,10 +183,12 @@ bool filename_initialise(void)
for (start = directory; *start != '\0'; start++) {
if (*start == '/') {
*start = '\0';
- LOG("Creating \"%s\"", directory);
+ NSLOG(netsurf, INFO, "Creating \"%s\"", directory);
ret = nsmkdir(directory, S_IRWXU);
if (ret != 0 && errno != EEXIST) {
- LOG("Failed to create directory \"%s\"", directory);
+ NSLOG(netsurf, INFO,
+ "Failed to create directory \"%s\"",
+ directory);
free(directory);
return false;
}
@@ -194,7 +197,7 @@ bool filename_initialise(void)
}
}
- LOG("Temporary directory location: %s", directory);
+ NSLOG(netsurf, INFO, "Temporary directory location: %s", directory);
ret = nsmkdir(directory, S_IRWXU);
free(directory);
@@ -280,7 +283,8 @@ 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));
+ NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
+ strerror(errno));
continue;
}
@@ -348,7 +352,8 @@ bool filename_flush_directory(const char *folder, int depth)
filename_delete_recursive(child);
if (remove(child))
- LOG("Failed to remove '%s'", child);
+ NSLOG(netsurf, INFO, "Failed to remove '%s'",
+ child);
else
changed = true;
} else {
@@ -387,7 +392,8 @@ 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));
+ NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
+ strerror(errno));
continue;
}
@@ -399,7 +405,7 @@ bool filename_delete_recursive(char *folder)
}
if (remove(child)) {
- LOG("Failed to remove '%s'", child);
+ NSLOG(netsurf, INFO, "Failed to remove '%s'", child);
closedir(parent);
return false;
}
@@ -465,7 +471,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()");
+ NSLOG(netsurf, INFO, "No memory for malloc()");
return NULL;
}
@@ -499,7 +505,9 @@ 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);
+ NSLOG(netsurf, INFO,
+ "Failed to create optimised structure '%s'",
+ filename_directory);
}
}
@@ -519,7 +527,9 @@ 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);
+ NSLOG(netsurf, INFO,
+ "Failed to create directory '%s'",
+ filename_directory);
return NULL;
}
}