remove extraneous tmp vars in libre_redirect
This commit is contained in:
parent
43cac7f3f1
commit
c8ff246cc2
2
TODO.md
2
TODO.md
|
@ -1,5 +1,7 @@
|
||||||
# To do
|
# To do
|
||||||
|
|
||||||
|
- [ ] Settle on a C standard (C11?), and use safer string handling functions provided by it.
|
||||||
|
- See make lint for purported insecurities
|
||||||
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
|
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
|
||||||
- [ ] This time, use something other than Whatsapp as an example syslink.
|
- [ ] This time, use something other than Whatsapp as an example syslink.
|
||||||
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
|
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
|
||||||
|
|
|
@ -13,7 +13,6 @@ int libre_redirect(const char* uri, char* output)
|
||||||
{
|
{
|
||||||
int len_uri = strlen(uri);
|
int len_uri = strlen(uri);
|
||||||
int len_output = strlen(output);
|
int len_output = strlen(output);
|
||||||
char tmp_uri[len_output++];
|
|
||||||
|
|
||||||
if ((len_output - len_uri) < LIBRE_N) {
|
if ((len_output - len_uri) < LIBRE_N) {
|
||||||
printf("Not enough memory\n");
|
printf("Not enough memory\n");
|
||||||
|
@ -47,9 +46,8 @@ int libre_redirect(const char* uri, char* output)
|
||||||
|
|
||||||
int len = sizeof(annoying_sites) / sizeof(annoying_sites[0]);
|
int len = sizeof(annoying_sites) / sizeof(annoying_sites[0]);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
strcpy(tmp_uri, uri);
|
|
||||||
str_init(output, len_output);
|
str_init(output, len_output);
|
||||||
int replace_check = str_replace_start(tmp_uri, annoying_sites[i],
|
int replace_check = str_replace_start(uri, annoying_sites[i],
|
||||||
alternatives[i], output);
|
alternatives[i], output);
|
||||||
switch(replace_check){
|
switch(replace_check){
|
||||||
case 0: // no match found
|
case 0: // no match found
|
||||||
|
|
Loading…
Reference in New Issue
Block a user