diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-03-12 16:19:09 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-03-12 16:19:09 -0400 |
commit | a2be4feb021023408f19829b56219a21da2a2e07 (patch) | |
tree | a2b9ee5c56978b19ab85037619dc4174d2ac17e7 | |
parent | 30df1f340f74d0eacc979215adff9c25a48047f0 (diff) | |
download | lite-xl-plugin-manager-a2be4feb021023408f19829b56219a21da2a2e07.tar.gz lite-xl-plugin-manager-a2be4feb021023408f19829b56219a21da2a2e07.zip |
Changed strnstr to strnstr_local because mac apparently has this function defined by default.
-rw-r--r-- | src/lpm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1014,7 +1014,7 @@ static int strncicmp(const char* a, const char* b, int n) { return 0; } -static const char* strnstr(const char* haystack, const char* needle, int n) { +static const char* strnstr_local(const char* haystack, const char* needle, int n) { int len = strlen(needle); for (int i = 0; i <= n - len; ++i) { if (strncmp(&haystack[i], needle, len) == 0) @@ -1174,7 +1174,7 @@ static int lpm_get(lua_State* L) { while (1) { // If we have an unknown amount of chunk bytes to be fetched, determine the size of the next chunk. while (chunk_length == -1) { - char* newline = (char*)strnstr(buffer, "\r\n", buffer_length); + char* newline = (char*)strnstr_local(buffer, "\r\n", buffer_length); if (newline) { *newline = '\0'; if (sscanf(buffer, "%x", &chunk_length) != 1) { @@ -1226,7 +1226,7 @@ static int lpm_get(lua_State* L) { goto finish; } if (buffer_length >= 2) { - if (!strnstr(buffer, "\r\n", 2)) { + if (!strnstr_local(buffer, "\r\n", 2)) { snprintf(err, sizeof(err), "invalid end to chunk for %s%s", hostname, rest); goto cleanup; } |