1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-04 07:33:07 +00:00

Improves performance of some file operations, fixes some memory leaks, and increases clarity.

* Avoids unnecessary alarm(0) when it is about to be set again, only
cleans up after it’s all done.

* Renames DIRCHAR to LISPDIRCHAR to be more descriptive, adds LISPDIRSTR
for contexts where a string is required rather than a character.

* Avoids leaks of directory structures by ensuring that any opendir()
has a matching closedir(), with a timeout check, on the return path

* Ensures that closedir() calls that could smash errno happen after
errno is saved for Lisp’s consumption

* Simplifies code to take advantage of strlcpy()/strlcat() guarantee
that destination string is NUL terminated

* Reduces number of unnecessary copies into scratch buffer for file name
processing

* Removes some commented out code left over from copy/paste of functions
This commit is contained in:
Nick Briggs
2025-05-22 17:33:33 -07:00
parent 38d65df90c
commit babe728d3a
3 changed files with 82 additions and 158 deletions

View File

@@ -38,9 +38,8 @@ extern unsigned int TIMEOUT_TIME;
} while (0)
#define S_TOUT(exp) \
alarm(TIMEOUT_TIME), \
(exp), \
alarm(0)
alarm(TIMEOUT_TIME), \
(exp)
#define ERRSETJMP(rval) \
do { \