aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-03-12 16:19:09 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-03-12 16:19:09 -0400
commita2be4feb021023408f19829b56219a21da2a2e07 (patch)
treea2b9ee5c56978b19ab85037619dc4174d2ac17e7 /src
parent30df1f340f74d0eacc979215adff9c25a48047f0 (diff)
downloadlite-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.
Diffstat (limited to 'src')
-rw-r--r--src/lpm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lpm.c b/src/lpm.c
index 16619c5..74c6a6a 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -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;
}