linux lib compatibility

This commit is contained in:
2026-06-03 09:20:00 +02:00
parent cec92cacd1
commit 564292b03e
16 changed files with 75 additions and 166 deletions
+5 -6
View File
@@ -16,7 +16,6 @@
#include "include/terminal.h"
#include "include/utf8.h"
#include "include/utils.h"
/**
* @file input.c
@@ -91,7 +90,7 @@ const char *fileCompletion(const char *path) {
// Cleanup when no more entries
closedir(dir);
dir = NULL;
bFree(entry);
free(entry);
appDebug("[FILE COMP] no entries\n");
return strdup(path);
}
@@ -113,7 +112,7 @@ const char *fileCompletion(const char *path) {
char *editorPrompt(char *prompt, char *placeHolder, char bPathMode) {
size_t buf_size = 256;
appDebug("[FILE COMP] %s %d\n", placeHolder, strlen(placeHolder));
char *buf = bAlloc(buf_size);
char *buf = malloc(buf_size);
size_t buf_len = 0;
int c = 0;
buf[0] = '\0';
@@ -130,7 +129,7 @@ char *editorPrompt(char *prompt, char *placeHolder, char bPathMode) {
}
} else if (c == ESCAPE) {
editorSetStatusMessage("");
bFree(buf);
free(buf);
return NULL;
} else if (c == '\r') {
if (buf_len != 0) {
@@ -152,14 +151,14 @@ char *editorPrompt(char *prompt, char *placeHolder, char bPathMode) {
memset(buf, 0, 256);
char *buf_complete = (char *)fileCompletion(path);
strcpy(buf, buf_complete);
bFree(buf_complete);
free(buf_complete);
buf_len = strlen(buf);
buf[buf_len] = '\0';
} else if (!iscntrl(c) && c < 256) {
if (buf_len == buf_size - 1) {
buf_size *= 2;
buf = bRealloc(buf, buf_size);
buf = realloc(buf, buf_size);
}
buf[buf_len++] = (char)c;
buf[buf_len] = '\0';