summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2025-11-28 22:01:20 +0100
committerTomas Bzatek <tbzatek@redhat.com>2025-11-28 22:01:20 +0100
commitd4564a0007d1b248af07d5a29a4bd9ccedb61fde (patch)
tree600da6e36cbcfca425d0b3439df823c667d58d47
parent69dd2b81de3bcbb955669f7937f3844b86467849 (diff)
downloadtuxcmd-d4564a0007d1b248af07d5a29a4bd9ccedb61fde.tar.xz
Misc. ULibc fixes
-rw-r--r--UChecksum.pas4
-rw-r--r--UChecksumDruid.pas6
-rw-r--r--UConfig.pas8
-rw-r--r--UCore.pas12
-rw-r--r--UCoreUtils.pas4
-rw-r--r--UCoreWorkers.pas6
-rw-r--r--UEngines.pas36
-rw-r--r--ULibc.pas15
-rw-r--r--UMain.pas12
-rw-r--r--USearch.pas2
-rw-r--r--UViewer.pas2
-rw-r--r--vfs/UVFSCore.pas42
12 files changed, 67 insertions, 82 deletions
diff --git a/UChecksum.pas b/UChecksum.pas
index a0922d7..5382086 100644
--- a/UChecksum.pas
+++ b/UChecksum.pas
@@ -228,7 +228,7 @@ begin
else if SFVPresent then FileList.Columns[1].Caption := 'CRC-32';
try
- Buffer := malloc(ChksumBlockSize);
+ Buffer := libc_malloc(ChksumBlockSize);
memset(Buffer, 0, ChksumBlockSize);
except
Application.MessageBox(LANGAnErrorOccuredWhileInitializingMemoryBlock, [mbOK], mbError, mbNone, mbOK);
@@ -402,7 +402,7 @@ begin
ProgressBar.Value := 0;
Application.ProcessMessages;
try
- Buffer := malloc(ChksumBlockSize);
+ Buffer := libc_malloc(ChksumBlockSize);
memset(Buffer, 0, ChksumBlockSize);
except
Application.MessageBox(LANGAnErrorOccuredWhileInitializingMemoryBlock, [mbOK], mbError, mbNone, mbOK);
diff --git a/UChecksumDruid.pas b/UChecksumDruid.pas
index fc62347..4804ab2 100644
--- a/UChecksumDruid.pas
+++ b/UChecksumDruid.pas
@@ -518,7 +518,7 @@ begin
HashString := '';
Result := False;
try
- FBuffer := malloc(ChksumBlockSize);
+ FBuffer := libc_malloc(ChksumBlockSize);
memset(FBuffer, 0, ChksumBlockSize);
except
ErrorLabel.Caption := ErrorLabel.Caption + LANGAnErrorOccuredWhileInitializingMemoryBlock + #10;
@@ -580,7 +580,7 @@ begin
Exit;
end;
try
- Buffer := malloc(ChksumBlockSize);
+ Buffer := libc_malloc(ChksumBlockSize);
memset(Buffer, 0, ChksumBlockSize);
except
ErrorLabel.Caption := ErrorLabel.Caption + LANGAnErrorOccuredWhileInitializingMemoryBlock + #10;
@@ -638,7 +638,7 @@ begin
Exit;
end;
try
- Buffer := malloc(ChksumBlockSize);
+ Buffer := libc_malloc(ChksumBlockSize);
memset(Buffer, 0, ChksumBlockSize);
except
ErrorLabel.Caption := ErrorLabel.Caption + LANGAnErrorOccuredWhileInitializingMemoryBlock + #10;
diff --git a/UConfig.pas b/UConfig.pas
index 1244f21..d3652a5 100644
--- a/UConfig.pas
+++ b/UConfig.pas
@@ -708,7 +708,7 @@ begin
Exit;
end;
s := IncludeTrailingPathDelimiter(s) + 'filetypes';
- if access(PChar(s), R_OK) = 0 then libc_remove(PChar(s));
+ libc_remove(PChar(s));
IniFile := TMyIniFile.Create(s, False);
try try
@@ -840,7 +840,7 @@ begin
Exit;
end;
s := IncludeTrailingPathDelimiter(s) + 'mounter';
- if access(PChar(s), R_OK) = 0 then libc_remove(PChar(s));
+ libc_remove(PChar(s));
IniFile := TMyIniFile.Create(s, False);
try try
@@ -1030,7 +1030,7 @@ begin
Exit;
end;
s := IncludeTrailingPathDelimiter(s) + 'connmgr';
- if access(PChar(s), R_OK) = 0 then libc_remove(PChar(s));
+ libc_remove(PChar(s));
IniFile := TMyIniFile.Create(s, False);
try try
@@ -1110,7 +1110,7 @@ function GetFileTime(FileName: string): time_t;
var StatBuf: Pstat64;
begin
Result := -1;
- StatBuf := malloc(sizeof(Tstat64));
+ StatBuf := libc_malloc(sizeof(Tstat64));
memset(StatBuf, 0, sizeof(Tstat64));
if lstat64(PChar(FileName), StatBuf) = 0 then Result := StatBuf^.st_mtime;
libc_free(StatBuf);
diff --git a/UCore.pas b/UCore.pas
index b314eb4..a2e0659 100644
--- a/UCore.pas
+++ b/UCore.pas
@@ -139,7 +139,7 @@ begin
if ListView.Items.Count = 0
then ListItem := ListView.Items.Add
else ListItem := ListView.Items[0];
- Data := malloc(SizeOf(TDataItem));
+ Data := libc_malloc(SizeOf(TDataItem));
memset(Data, 0, SizeOf(TDataItem));
with Data^ do begin
UpDir := True;
@@ -405,7 +405,7 @@ var DirStage1List, FilesList, DirStage2List: TList;
if Engine.GetListing(LocalList, LocalPath, True, False, True, @Error) then begin
for i := 0 to LocalList.Count - 1 do begin
Item := LocalList[i];
- ItemSL := malloc(sizeof(TDataItemSL));
+ ItemSL := libc_malloc(sizeof(TDataItemSL));
memset(ItemSL, 0, sizeof(TDataItemSL));
ItemSL^.DataItem := Item;
ItemSL^.Stage1 := True;
@@ -498,7 +498,7 @@ begin
DataItem := Engine.GetFileInfo(APath, False, True, nil);
if DataItem = nil then Exit; // Inaccessible file
- ItemSL := malloc(sizeof(TDataItemSL));
+ ItemSL := libc_malloc(sizeof(TDataItemSL));
memset(ItemSL, 0, sizeof(TDataItemSL));
// * TODO: report errors? same way as for FillDirFiles
ItemSL^.DataItem := DataItem;
@@ -796,7 +796,7 @@ var t: time_t;
Data^.Size := ASize;
s := FormatSize(ASize, 0);
libc_free(Data^.ColumnData[3]);
-// Data^.ColumnData[3] := malloc(Length(s) + 1);
+// Data^.ColumnData[3] := libc_malloc(Length(s) + 1);
// memset(Data^.ColumnData[3], 0, Length(s) + 1);
Data^.ColumnData[3] := strdup(PChar(s));
except end;
@@ -870,7 +870,7 @@ begin
if Pos('.', FileName) > 1 then FileName := ChangeFileExt(FileName, '.crc')
else FileName := FileName + '.crc';
try
- Buffer := malloc(CRCBlockSize);
+ Buffer := libc_malloc(CRCBlockSize);
memset(Buffer, 0, CRCBlockSize);
except
Application.MessageBox(LANGAnErrorOccuredWhileInitializingMemoryBlock, [mbOK], mbError, mbNone, mbOK);
@@ -1112,7 +1112,7 @@ begin
if Assigned(DirEnt) and Assigned(PChar(@DirEnt^.d_name[0])) then begin
Buf := Pchar(@DirEnt^.d_name[0]);
if (Buf <> '.') and (Buf <> '..') and (DirEnt^.d_name[0] <> #0) then begin
- StatBuf := malloc(sizeof(Tstat64));
+ StatBuf := libc_malloc(sizeof(Tstat64));
memset(StatBuf, 0, sizeof(Tstat64));
if lstat64(PChar(APath + string(Buf)), StatBuf) = 0 then
if __S_ISTYPE(StatBuf^.st_mode, __S_IFDIR)
diff --git a/UCoreUtils.pas b/UCoreUtils.pas
index eafd8bc..3eb7282 100644
--- a/UCoreUtils.pas
+++ b/UCoreUtils.pas
@@ -266,7 +266,7 @@ begin
14: DateFormat := '%y/%m/%d'; // 08/06/24
else DateFormat := CustDateFormat; // Custom date format
end;
- Buf := malloc(255);
+ Buf := libc_malloc(255);
memset(Buf, 0, 255);
placed := strftime(Buf, 254, PChar(DateFormat), time_tm);
if placed <= 0 then DebugMsg(['FormatDate: error converting date. The result will be unpredictable.']);
@@ -290,7 +290,7 @@ begin
11: TimeFormat := '%H%M'; // 1311
else TimeFormat := CustTimeFormat; // Custom Time format
end;
- Buf := malloc(255);
+ Buf := libc_malloc(255);
memset(Buf, 0, 255);
placed := strftime(Buf, 254, PChar(TimeFormat), time_tm);
if placed <= 0 then DebugMsg(['FormatDate: error converting time. The result will be unpredictable.']);
diff --git a/UCoreWorkers.pas b/UCoreWorkers.pas
index 8e2207e..694b7bf 100644
--- a/UCoreWorkers.pas
+++ b/UCoreWorkers.pas
@@ -1062,7 +1062,7 @@ var DefResponse: integer; // Global variables for this function
end;
BSize := DestEngine.GetBlockSize;
- Buffer := malloc(BSize);
+ Buffer := libc_malloc(BSize);
if Buffer = nil then begin
g_set_error(Error, TUXCMD_ERROR, gint(TUXCMD_ERROR_ALLOC_FAILED), '%m', []);
CopyFilesWorker_ProgressFunc(Self, 0, Error^); // Memory allocation failed
@@ -1728,7 +1728,7 @@ begin
else MergeBlockSize := 65536*4;
FreeDataItem(Stat);
try
- Buffer := malloc(MergeBlockSize);
+ Buffer := libc_malloc(MergeBlockSize);
memset(Buffer, 0, MergeBlockSize);
except
FCancelMessage := LANGAnErrorOccuredWhileInitializingMemoryBlock;
@@ -1922,7 +1922,7 @@ begin
List := TList.Create;
try
- Buffer := malloc(SplitBlockSize);
+ Buffer := libc_malloc(SplitBlockSize);
memset(Buffer, 0, SplitBlockSize);
except
FCancelMessage := LANGAnErrorOccuredWhileInitializingMemoryBlock;
diff --git a/UEngines.pas b/UEngines.pas
index 13acf84..7bfc355 100644
--- a/UEngines.pas
+++ b/UEngines.pas
@@ -288,7 +288,7 @@ var Item: PDataItem;
LnkBuf: array[0..65535] of char;
i: integer;
begin
- StatBuf := malloc(sizeof(Tstat64));
+ StatBuf := libc_malloc(sizeof(Tstat64));
memset(StatBuf, 0, sizeof(Tstat64));
if lstat64(PChar(APath), StatBuf) <> 0 then begin
g_set_error(Error, TUXCMD_ERROR, gint(TUXCMD_ERROR_STAT), '%m', []);
@@ -298,7 +298,7 @@ begin
Exit;
end;
- Item := malloc(sizeof(TDataItem));
+ Item := libc_malloc(sizeof(TDataItem));
memset(Item, 0, sizeof(TDataItem));
Item^.UpDir := False;
Item^.LnkPointTo := nil;
@@ -333,7 +333,7 @@ begin
if i >= 0 then
Item^.LnkPointTo := g_strdup(@LnkBuf[0]);
if FollowSymlinks then begin
- StatBuf := malloc(sizeof(Tstat64));
+ StatBuf := libc_malloc(sizeof(Tstat64));
memset(StatBuf, 0, sizeof(Tstat64));
if stat64(PChar(APath), StatBuf) = 0 then begin
Item^.IsDir := __S_ISTYPE(StatBuf^.st_mode, __S_IFDIR);
@@ -350,7 +350,7 @@ end;
function TLocalTreeEngine.CreateFakeFileInfo(const APath: string; AddFullPath: boolean): PDataItem;
var Item: PDataItem;
begin
- Item := malloc(sizeof(TDataItem));
+ Item := libc_malloc(sizeof(TDataItem));
memset(Item, 0, sizeof(TDataItem));
Item^.UpDir := False;
Item^.LnkPointTo := nil;
@@ -437,7 +437,7 @@ function TLocalTreeEngine.GetDirSize(const APath: string): Int64;
if DirEnt <> nil then begin
Buf := PChar(@DirEnt^.d_name[0]);
if (strlen(Buf) > 0) and (Buf <> '.') and (Buf <> '..') then begin
- StatBuf := malloc(sizeof(Tstat64));
+ StatBuf := libc_malloc(sizeof(Tstat64));
memset(StatBuf, 0, sizeof(Tstat64));
if lstat64(Buf, StatBuf) = 0 then begin
if __S_ISTYPE(StatBuf^.st_mode, __S_IFDIR) then begin
@@ -529,7 +529,7 @@ var timebuf: Putimbuf;
begin
Result := False;
try
- timebuf := malloc(sizeof(Tutimbuf));
+ timebuf := libc_malloc(sizeof(Tutimbuf));
memset(timebuf, 0, sizeof(Tutimbuf));
timebuf^.actime := atime;
timebuf^.modtime := mtime;
@@ -581,7 +581,7 @@ begin
Exit;
end;
- Buffer := malloc(FBlockSize);
+ Buffer := libc_malloc(FBlockSize);
if Buffer = nil then begin
g_set_error(Error, TUXCMD_ERROR, gint(TUXCMD_ERROR_ALLOC_FAILED), '%m', []);
libc_close(fdest);
@@ -676,7 +676,7 @@ end;
function TLocalTreeEngine.FileExists(const FileName: string; FollowSymlinks: boolean): boolean;
var st: Pstat64;
begin
- st := malloc(sizeof(Tstat64));
+ st := libc_malloc(sizeof(Tstat64));
memset(st, 0, sizeof(Tstat64));
if not FollowSymlinks then Result := lstat64(PChar(FileName), st) = 0
else Result := stat64(PChar(FileName), st) = 0;
@@ -687,7 +687,7 @@ end;
function TLocalTreeEngine.DirectoryExists(const FileName: string; FollowSymlinks: boolean): boolean;
var st: Pstat64;
begin
- st := malloc(sizeof(Tstat64));
+ st := libc_malloc(sizeof(Tstat64));
memset(st, 0, sizeof(Tstat64));
if not FollowSymlinks then Result := lstat64(PChar(FileName), st) = 0
else Result := stat64(PChar(FileName), st) = 0;
@@ -708,8 +708,8 @@ var FStat1, FStat2: Pstat64;
begin
// DebugMsg(['** TLocalTreeEngine.IsOnSameFS("', Path1, '", "', Path2, '")']);
Result := False; // Default fallback result (forces copy + delete)
- FStat1 := malloc(sizeof(Tstat64));
- FStat2 := malloc(sizeof(Tstat64));
+ FStat1 := libc_malloc(sizeof(Tstat64));
+ FStat2 := libc_malloc(sizeof(Tstat64));
memset(FStat1, 0, sizeof(Tstat64));
memset(FStat2, 0, sizeof(Tstat64));
if FollowSymlinks then Res1 := stat64(PChar(Path1), FStat1)
@@ -731,8 +731,8 @@ var FStat1, FStat2: Pstat64;
Res1, Res2: integer;
begin
Result := False;
- FStat1 := malloc(sizeof(Tstat64));
- FStat2 := malloc(sizeof(Tstat64));
+ FStat1 := libc_malloc(sizeof(Tstat64));
+ FStat2 := libc_malloc(sizeof(Tstat64));
memset(FStat1, 0, sizeof(Tstat64));
memset(FStat2, 0, sizeof(Tstat64));
if FollowSymlinks then Res1 := stat64(PChar(Path1), FStat1)
@@ -760,7 +760,7 @@ begin
FSFree := -1;
FSName := '';
try
- Stat := malloc(sizeof(Tstatfs64));
+ Stat := libc_malloc(sizeof(Tstatfs64));
memset(Stat, 0, sizeof(Tstatfs64));
if statfs64(PChar(APath), Stat) <> 0 then Exit;
FSSize := Stat^.f_bsize * Stat^.f_blocks;
@@ -861,7 +861,7 @@ var Stat: Pstatfs64;
begin
Result := False;
try
- Stat := malloc(sizeof(Tstatfs64));
+ Stat := libc_malloc(sizeof(Tstatfs64));
memset(Stat, 0, sizeof(Tstatfs64));
if statfs64(PChar(FileName), Stat) = 0 then
Result := (Stat^.f_type = $9660); { ISOFS_SUPER_MAGIC }
@@ -874,7 +874,7 @@ end;
(********************************************************************************************************************************)
function TLocalTreeEngine.FileCanRun(const FileName: string): boolean;
begin
- Result := access(PChar(FileName), R_OK or X_OK) = 0;
+ Result := g_access(PChar(FileName), R_OK or X_OK) = 0;
end;
@@ -918,7 +918,7 @@ function DuplicateDataItem(DataItem: PDataItem): PDataItem;
var NewDataItem: PDataItem;
i: integer;
begin
- NewDataItem := malloc(sizeof(TDataItem));
+ NewDataItem := libc_malloc(sizeof(TDataItem));
memcpy(NewDataItem, DataItem, sizeof(TDataItem));
NewDataItem^.FName := g_strdup(DataItem^.FName);
NewDataItem^.FDisplayName := g_strdup(DataItem^.FDisplayName);
@@ -931,7 +931,7 @@ end;
function DuplicateDataItem(DataItem: PDataItemSL): PDataItemSL;
var NewDataItem: PDataItemSL;
begin
- NewDataItem := malloc(sizeof(TDataItemSL));
+ NewDataItem := libc_malloc(sizeof(TDataItemSL));
memcpy(NewDataItem, DataItem, sizeof(TDataItemSL));
NewDataItem^.ADestination := g_strdup(DataItem^.ADestination);
NewDataItem^.DataItem := DuplicateDataItem(DataItem^.DataItem);
diff --git a/ULibc.pas b/ULibc.pas
index d445e62..abc8a68 100644
--- a/ULibc.pas
+++ b/ULibc.pas
@@ -407,21 +407,14 @@ function dlclose(handle: Pointer): Longint; cdecl; external DL_LIB name 'dlclose
function dlsym(handle: Pointer; const symbol: PChar): Pointer; cdecl; external DL_LIB name 'dlsym';
function dlerror: PChar; cdecl; external GLIBC_LIB name 'dlerror';
-function real_libc_malloc(size: size_t): Pointer; cdecl; external GLIBC_LIB name 'malloc';
+function libc_malloc(size: size_t): Pointer; cdecl; external GLIBC_LIB name 'malloc';
function malloc(size: size_t): Pointer; cdecl; external GLIBC_LIB name 'malloc';
-function calloc(nmemb: size_t; size: size_t): Pointer; cdecl; external GLIBC_LIB name 'calloc';
-function realloc(ptr: Pointer; size: size_t): Pointer; cdecl; external GLIBC_LIB name 'realloc';
-procedure real_libc_free(ptr: Pointer); cdecl; external GLIBC_LIB name 'free';
procedure free(ptr: Pointer); cdecl; external GLIBC_LIB name 'free';
procedure libc_free(ptr: Pointer); cdecl; external GLIBC_LIB name 'free';
function memcpy(dest: Pointer; src: Pointer; n: size_t): Pointer; cdecl; external GLIBC_LIB name 'memcpy';
-function memmove(dest: Pointer; src: Pointer; n: size_t): Pointer; cdecl; external GLIBC_LIB name 'memmove';
-function memccpy(dest: Pointer; src: Pointer; c: longint; n: size_t): Pointer; cdecl; external GLIBC_LIB name 'memccpy';
function memset(s: Pointer; c: Longint; n: size_t): Pointer; cdecl; external GLIBC_LIB name 'memset';
-function memcmp(s1: Pointer; s2: Pointer; n: size_t): Longint; cdecl; external GLIBC_LIB name 'memcmp';
-function memchr(s: Pointer; c: Longint; n: size_t): Pointer; cdecl; external GLIBC_LIB name 'memchr';
function strcpy(dest: PChar; const src: PChar): PChar; cdecl; external GLIBC_LIB name 'strcpy';
function strncpy(dest: PChar; const src: PChar; n: size_t): PChar; cdecl; external GLIBC_LIB name 'strncpy';
function strcat(dest: PChar; const src: PChar): PChar; cdecl; external GLIBC_LIB name 'strcat';
@@ -500,10 +493,8 @@ function time(t: Ptime_t): time_t; cdecl; external GLIBC_LIB name 'time';
function libc_time(t: Ptime_t): time_t; cdecl; external GLIBC_LIB name 'time';
function mktime(timep: Ptm): time_t; cdecl; external GLIBC_LIB name 'mktime';
function strftime(s: PChar; max: size_t; const format: PChar; tm: Ptm): size_t; cdecl; external GLIBC_LIB name 'strftime';
-function gmtime(timep: Ptime_t): Ptm; cdecl; external GLIBC_LIB name 'gmtime';
function localtime(timep: Ptime_t): Ptm; cdecl; external GLIBC_LIB name 'localtime';
function ctime(timep: Ptime_t): PChar; cdecl; external GLIBC_LIB name 'ctime';
-function usleep(usec: DWord): Longint; cdecl; external GLIBC_LIB name 'usleep';
function fopen(const path: PChar; const mode: PChar): PFILE; cdecl; external GLIBC_LIB name 'fopen';
function fopen64(const path: PChar; const mode: PChar): PFILE; cdecl; external GLIBC_LIB name 'fopen64';
@@ -545,10 +536,6 @@ function geteuid: __uid_t; cdecl; external GLIBC_LIB name 'geteuid';
function getgid: __gid_t; cdecl; external GLIBC_LIB name 'getgid';
function getegid: __gid_t; cdecl; external GLIBC_LIB name 'getegid';
-function access(pathname: PChar; mode: Longint): Longint; cdecl; external GLIBC_LIB name 'access';
-function euidaccess(pathname: PChar; mode: Longint): Longint; cdecl; external GLIBC_LIB name 'euidaccess';
-
-function setenv(name: PChar; value: PChar; overwrite: Longint): Longint; cdecl; external GLIBC_LIB name 'setenv';
implementation
diff --git a/UMain.pas b/UMain.pas
index 5c96866..2f5a2d3 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -2948,12 +2948,11 @@ begin
if Key = GDK_KEY_BackSpace then begin
if g_utf8_strlen(PChar(Entry.Text), -1) > 0 then begin
// DebugMsg(['TFMain.QuickFindSendKey: before delete: "', Entry.Text, '", ansi = "', UTF8ToStr(Entry.Text), '"']);
- g := malloc(Length(Entry.Text));
- memset(g, 0, Length(Entry.Text));
+ g := g_malloc0(Length(Entry.Text));
g_utf8_strncpy(g, PChar(Entry.Text), g_utf8_strlen(PChar(Entry.Text), -1) - 1);
// DebugMsg(['TFMain.QuickFindSendKey: after delete: "', g, '", ansi = "', UTF8ToStr(g), '"']);
Entry.Text := g;
- libc_free(g);
+ g_free(g);
end;
NewText := Entry.Text;
end else
@@ -5558,11 +5557,10 @@ procedure TFMain.SetTabLabel(Notebook: TEphyNotebook; PageIndex: integer; ALabel
var g: PChar;
begin
if (ConfTabMaxLength > 0) and (g_utf8_strlen(PChar(ALabel), -1) > ConfTabMaxLength) then begin
- g := malloc(Length(ALabel) + 4);
- memset(g, 0, Length(ALabel) + 4);
+ g := g_malloc0(Length(ALabel) + 4);
g_utf8_strncpy(g, PChar(ALabel), ConfTabMaxLength);
ALabel := g + '...';
- libc_free(g);
+ g_free(g);
end;
Notebook.SetTabCaption(PageIndex, ALabel);
Notebook.SetTabTooltip(PageIndex, ATooltip);
@@ -6239,7 +6237,7 @@ begin
DebugMsg(['(II) ExtractFromArchive: New path = ', NewPath]);
// Test for read access to the new file
- if (not ExtractAll) and (access(PChar(NewPath), R_OK) <> 0) then begin
+ if (not ExtractAll) and (g_access(PChar(NewPath), R_OK) <> 0) then begin
Result := False;
DebugMsg(['(EE) ExtractFromArchive: access test to the new file failed.']);
end;
diff --git a/USearch.pas b/USearch.pas
index 5e981e0..b6ba0a2 100644
--- a/USearch.pas
+++ b/USearch.pas
@@ -1089,7 +1089,7 @@ var fd: TEngineFileDes;
begin
Result := False;
try
- Buffer := malloc(BlockSize);
+ Buffer := libc_malloc(BlockSize);
if Buffer = nil then Exit;
memset(Buffer, 0, BlockSize);
fd := FEngine.OpenFile(FileName, omRead, nil);
diff --git a/UViewer.pas b/UViewer.pas
index 0eceba8..4c37af2 100644
--- a/UViewer.pas
+++ b/UViewer.pas
@@ -184,7 +184,7 @@ begin
Inc(i);
end;
// gdk_window_process_all_updates;
- usleep(100);
+ g_usleep(100);
until (microseconds div 1000) > dur;
gtk_adjustment_set_value(adj, dest_value);
// gdk_window_process_all_updates;
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas
index 216cd5e..594eabf 100644
--- a/vfs/UVFSCore.pas
+++ b/vfs/UVFSCore.pas
@@ -259,14 +259,14 @@ begin
s := FVFSGetArchiveExts();
if s <> nil then begin
ParseString(String(s), ';', Extensions);
- real_libc_free(s);
+ libc_free(s);
end;
end;
if (FVFSGetNetworkServices <> nil) and (FVFSOpenURI <> nil) then begin
s := FVFSGetNetworkServices();
if s <> nil then begin
ParseString(String(s), ';', Services);
- real_libc_free(s);
+ libc_free(s);
end;
end;
end;
@@ -289,10 +289,10 @@ end;
procedure _free_PVFSInfo(Info: PVFSInfo);
begin
if Info <> nil then begin
- if Info^.Name <> nil then real_libc_free(Info^.Name);
- if Info^.ID <> nil then real_libc_free(Info^.ID);
- if Info^.About <> nil then real_libc_free(Info^.About);
- if Info^.Copyright <> nil then real_libc_free(Info^.Copyright);
+ if Info^.Name <> nil then libc_free(Info^.Name);
+ if Info^.ID <> nil then libc_free(Info^.ID);
+ if Info^.About <> nil then libc_free(Info^.About);
+ if Info^.Copyright <> nil then libc_free(Info^.Copyright);
end;
end;
@@ -481,10 +481,10 @@ begin
Item := GetDataItemFromVFSItem(P);
List.Add(Item);
end;
- if P^.FName <> nil then real_libc_free(P^.FName);
- if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName);
- if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo);
- real_libc_free(P);
+ if P^.FName <> nil then libc_free(P^.FName);
+ if P^.FDisplayName <> nil then libc_free(P^.FDisplayName);
+ if P^.sLinkTo <> nil then libc_free(P^.sLinkTo);
+ libc_free(P);
P := FSourcePlugin.FVFSListNext(FGlobs, Error);
VFSToTuxcmdError(Error, TUXCMD_ERROR_OPENDIR);
end;
@@ -497,7 +497,7 @@ begin
g_set_error_literal(Error, TUXCMD_ERROR, gint(TUXCMD_ERROR_CANCELLED), 'The operation has been cancelled.');
Result := False;
end;
- real_libc_free(P);
+ libc_free(P);
FSourcePlugin.FVFSListClose(FGlobs, nil);
except
on E: Exception do begin
@@ -525,10 +525,10 @@ begin
VFSToTuxcmdError(Error, TUXCMD_ERROR_STAT);
if P <> nil then begin
Result := GetDataItemFromVFSItem(P);
- if P^.FName <> nil then real_libc_free(P^.FName);
- if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName);
- if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo);
- real_libc_free(P);
+ if P^.FName <> nil then libc_free(P^.FName);
+ if P^.FDisplayName <> nil then libc_free(P^.FDisplayName);
+ if P^.sLinkTo <> nil then libc_free(P^.sLinkTo);
+ libc_free(P);
end;
except
on E: Exception do begin
@@ -557,7 +557,7 @@ begin
FSFree := AFSFree;
if AFSName <> nil then begin
FSName := string(AFSName);
- real_libc_free(AFSName);
+ libc_free(AFSName);
end;
end;
end;
@@ -583,7 +583,7 @@ begin
s := FSourcePlugin.FVFSGetPath(FGlobs);
if s <> nil then begin
Result := String(s);
- real_libc_free(s);
+ libc_free(s);
end;
end;
end;
@@ -596,7 +596,7 @@ begin
s := FSourcePlugin.FVFSGetPathURI(FGlobs);
if s <> nil then begin
Result := String(s);
- real_libc_free(s);
+ libc_free(s);
end;
end;
end;
@@ -651,7 +651,7 @@ begin
try
P := FSourcePlugin.FVFSFileInfo(FGlobs, PChar(FileName), FollowSymlinks, False, nil);
Result := P <> nil;
- real_libc_free(P);
+ libc_free(P);
except
on E: Exception do
DebugMsg(['^^VFS (EE): FileExists: Exception: ', E.Message]);
@@ -667,7 +667,7 @@ begin
try
P := FSourcePlugin.FVFSFileInfo(FGlobs, PChar(FileName), FollowSymlinks, False, nil);
Result := (P <> nil) and (TVFSItemType(P^.ItemType) = vDirectory);
- real_libc_free(P);
+ libc_free(P);
except
on E: Exception do
DebugMsg(['^^VFS (EE): FileExists: Exception: ', E.Message]);
@@ -1148,7 +1148,7 @@ end;
procedure DoInitPlugins;
begin
if ParamDebug then
- setenv('TUXCMD_DEBUG', '1', 1);
+ g_setenv('TUXCMD_DEBUG', '1', True);
PluginList := TList.Create;
if not ParamDisablePlugins then begin
BinaryPath := GetBinaryPath;