Simplify rules display property assignment - surf-adblock - Surf adblock web ex… | |
git clone git://git.codemadness.org/surf-adblock | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit fd00cc5304e3e118f4c692cede055cd2baf62307 | |
parent 45bbe933e712772b3f1513c8a8970b7e2743f07c | |
Author: Quentin Rameau <[email protected]> | |
Date: Sat, 3 Jun 2017 22:12:31 +0200 | |
Simplify rules display property assignment | |
Diffstat: | |
M surf-adblock.c | 14 +++++--------- | |
1 file changed, 5 insertions(+), 9 deletions(-) | |
--- | |
diff --git a/surf-adblock.c b/surf-adblock.c | |
@@ -812,19 +812,15 @@ documentloaded(WebKitWebPage *wp, Page *p) | |
for (r = rules; r; r = r->next) { | |
if (!r->css || !r->domains || !matchrule(r, "", "", domain)) | |
continue; | |
+ | |
len = strlen(r->css); | |
if (string_append(&sitecss, r->css, len) < len) | |
return; | |
- if (r->isexception) { | |
- len = sizeof("{display:initial;}") -1; | |
- if (string_append(&sitecss, "{display:initial;}", len)… | |
- return; | |
- } else { | |
- len = sizeof("{display:none;}") -1; | |
- if (string_append(&sitecss, "{display:none;}", len) < … | |
- return; | |
- } | |
+ s = r->isexception ? "{display:initial;}" : "{display:none;}"; | |
+ len = strlen(s); | |
+ if (string_append(&sitecss, s, len) < len) | |
+ return; | |
} | |
/* printf("sitecss: %s\n", sitecss.data ? sitecss.data : "<empty>");*/ | |