From 75018632a9b953aafeae6f4e8aea607fd1d89dca Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:28:12 +0100 Subject: 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); --- content/urldb.c | 60 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'content/urldb.c') diff --git a/content/urldb.c b/content/urldb.c index 313ec316d..add2a1d80 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -662,7 +662,8 @@ static bool urldb__host_is_ip_address(const char *host) c[slash - host] = '\0'; sane_host = c; host_len = slash - host; - LOG("WARNING: called with non-host '%s'", host); + NSLOG(netsurf, INFO, "WARNING: called with non-host '%s'", + host); } if (strspn(sane_host, "0123456789abcdefABCDEF[].:") < host_len) @@ -1292,7 +1293,7 @@ urldb_match_path(const struct path_data *parent, assert(parent->segment == NULL); if (path[0] != '/') { - LOG("path is %s", path); + NSLOG(netsurf, INFO, "path is %s", path); } assert(path[0] == '/'); @@ -1422,12 +1423,14 @@ static void urldb_dump_paths(struct path_data *parent) do { if (p->segment != NULL) { - LOG("\t%s : %u", lwc_string_data(p->scheme), p->port); + NSLOG(netsurf, INFO, "\t%s : %u", + lwc_string_data(p->scheme), p->port); - LOG("\t\t'%s'", p->segment); + NSLOG(netsurf, INFO, "\t\t'%s'", p->segment); for (i = 0; i != p->frag_cnt; i++) { - LOG("\t\t\t#%s", p->fragment[i]); + NSLOG(netsurf, INFO, "\t\t\t#%s", + p->fragment[i]); } } @@ -1457,10 +1460,10 @@ static void urldb_dump_hosts(struct host_part *parent) struct host_part *h; if (parent->part) { - LOG("%s", parent->part); + NSLOG(netsurf, INFO, "%s", parent->part); - LOG("\t%s invalid SSL certs", - parent->permit_invalid_certs ? "Permits" : "Denies"); + NSLOG(netsurf, INFO, "\t%s invalid SSL certs", + parent->permit_invalid_certs ? "Permits" : "Denies"); } /* Dump path data */ @@ -1512,7 +1515,7 @@ static void urldb_dump_search(struct search_node *parent, int depth) } s[i]= 0; - LOG("%s", s); + NSLOG(netsurf, INFO, "%s", s); urldb_dump_search(parent->right, depth + 1); } @@ -2866,14 +2869,15 @@ nserror urldb_load(const char *filename) assert(filename); - LOG("Loading URL file %s", filename); + NSLOG(netsurf, INFO, "Loading URL file %s", filename); if (url_bloom == NULL) url_bloom = bloom_create(BLOOM_SIZE); fp = fopen(filename, "r"); if (!fp) { - LOG("Failed to open file '%s' for reading", filename); + NSLOG(netsurf, INFO, "Failed to open file '%s' for reading", + filename); return NSERROR_NOT_FOUND; } @@ -2884,12 +2888,12 @@ nserror urldb_load(const char *filename) version = atoi(s); if (version < MIN_URL_FILE_VERSION) { - LOG("Unsupported URL file version."); + NSLOG(netsurf, INFO, "Unsupported URL file version."); fclose(fp); return NSERROR_INVALID; } if (version > URL_FILE_VERSION) { - LOG("Unknown URL file version."); + NSLOG(netsurf, INFO, "Unknown URL file version."); fclose(fp); return NSERROR_INVALID; } @@ -2919,13 +2923,13 @@ nserror urldb_load(const char *filename) /* no URLs => try next host */ if (urls == 0) { - LOG("No URLs for '%s'", host); + NSLOG(netsurf, INFO, "No URLs for '%s'", host); continue; } h = urldb_add_host(host); if (!h) { - LOG("Failed adding host: '%s'", host); + NSLOG(netsurf, INFO, "Failed adding host: '%s'", host); fclose(fp); return NSERROR_NOMEM; } @@ -2976,7 +2980,8 @@ nserror urldb_load(const char *filename) * Need a nsurl_save too. */ if (nsurl_create(url, &nsurl) != NSERROR_OK) { - LOG("Failed inserting '%s'", url); + NSLOG(netsurf, INFO, "Failed inserting '%s'", + url); fclose(fp); return NSERROR_NOMEM; } @@ -2989,7 +2994,8 @@ nserror urldb_load(const char *filename) /* Copy and merge path/query strings */ if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY, &path_query, &len) != NSERROR_OK) { - LOG("Failed inserting '%s'", url); + NSLOG(netsurf, INFO, "Failed inserting '%s'", + url); fclose(fp); return NSERROR_NOMEM; } @@ -3000,7 +3006,8 @@ nserror urldb_load(const char *filename) p = urldb_add_path(scheme_lwc, port, h, path_query, fragment_lwc, nsurl); if (!p) { - LOG("Failed inserting '%s'", url); + NSLOG(netsurf, INFO, "Failed inserting '%s'", + url); fclose(fp); return NSERROR_NOMEM; } @@ -3044,7 +3051,7 @@ nserror urldb_load(const char *filename) } fclose(fp); - LOG("Successfully loaded URL file"); + NSLOG(netsurf, INFO, "Successfully loaded URL file"); #undef MAXIMUM_URL_LENGTH return NSERROR_OK; @@ -3060,7 +3067,8 @@ nserror urldb_save(const char *filename) fp = fopen(filename, "w"); if (!fp) { - LOG("Failed to open file '%s' for writing", filename); + NSLOG(netsurf, INFO, "Failed to open file '%s' for writing", + filename); return NSERROR_SAVE_FAILED; } @@ -3472,7 +3480,7 @@ bool urldb_set_thumbnail(nsurl *url, struct bitmap *bitmap) return false; } - LOG("Setting bitmap on %s", nsurl_access(url)); + NSLOG(netsurf, INFO, "Setting bitmap on %s", nsurl_access(url)); if ((p->thumb) && (p->thumb != bitmap)) { guit->bitmap->destroy(p->thumb); @@ -3754,7 +3762,8 @@ bool urldb_set_cookie(const char *header, nsurl *url, nsurl *referer) } suffix = nspsl_getpublicsuffix(dot); if (suffix == NULL) { - LOG("domain %s was a public suffix domain", dot); + NSLOG(netsurf, INFO, + "domain %s was a public suffix domain", dot); urldb_free_cookie(c); goto error; } @@ -4161,7 +4170,7 @@ void urldb_load_cookies(const char *filename) for (; *p && *p != '\t'; p++) \ ; /* do nothing */ \ if (p >= end) { \ - LOG("Overran input"); \ + NSLOG(netsurf, INFO, "Overran input"); \ continue; \ } \ *p++ = '\0'; \ @@ -4171,7 +4180,7 @@ void urldb_load_cookies(const char *filename) for (; *p && *p == '\t'; p++) \ ; /* do nothing */ \ if (p >= end) { \ - LOG("Overran input"); \ + NSLOG(netsurf, INFO, "Overran input"); \ continue; \ } \ } @@ -4200,7 +4209,8 @@ void urldb_load_cookies(const char *filename) if (loaded_cookie_file_version < MIN_COOKIE_FILE_VERSION) { - LOG("Unsupported Cookie file version"); + NSLOG(netsurf, INFO, + "Unsupported Cookie file version"); break; } -- cgit v1.2.3