diff --git a/TODO.md b/TODO.md index 7ed4bda..c96dc2a 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,9 @@ # To do +- [ ] Look into improving speed and performance: + - [ ] Creating objects only once, e.g., for js strings that I execte + - [ ] Look into using global controllers, rather than one for each webview + - [ ] etc. - [ ] Move to a later C standard (C11?) and use safer string handling functions provided by it. - The thing is, I kinda feel attached to C89-C99 - [ ] Consider diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c index 6a60355..bbbd4a5 100644 --- a/plugins/libre_redirect/libre_redirect.c +++ b/plugins/libre_redirect/libre_redirect.c @@ -68,5 +68,7 @@ int libre_redirect(const char* uri, char* output) } strcpy(output, uri); } - return 0; + + int utm_check = str_destructively_omit_from(output, "?utm"); + return utm_check * 2; } diff --git a/plugins/strings/strings.c b/plugins/strings/strings.c index 59bfdc9..c95f872 100644 --- a/plugins/strings/strings.c +++ b/plugins/strings/strings.c @@ -59,3 +59,26 @@ See also: * * https://github.com/irl/la-cucina/blob/master/str_replace.c */ + + +int str_destructively_omit_from(char* input, const char* from){ + // input = "https://url.com/?utm=blah", from = "?utm" + int l1 = strlen(input); + int l2 = strlen(from); + + for(int i=0; i l1) { // no more room + continue; + } + for(int j=0; j #include #include -#define STYLE_N 9331 + 1000 +#define STYLE_N 9379 + 1000 void read_style_js(char* string) { diff --git a/plugins/style/style.h b/plugins/style/style.h index f061800..9588ed1 100644 --- a/plugins/style/style.h +++ b/plugins/style/style.h @@ -1,5 +1,5 @@ #pragma once -#define STYLE_N 9331 + 1000 +#define STYLE_N 9379 + 1000 void read_style_js(char* string);