Skip to content

Commit c2b1b7a

Browse files
committed
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
1 parent d822d47 commit c2b1b7a

File tree

3 files changed

+82
-158
lines changed

3 files changed

+82
-158
lines changed

inc/timeout.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ extern unsigned int TIMEOUT_TIME;
3838
} while (0)
3939

4040
#define S_TOUT(exp) \
41-
alarm(TIMEOUT_TIME), \
42-
(exp), \
43-
alarm(0)
41+
alarm(TIMEOUT_TIME), \
42+
(exp)
4443

4544
#define ERRSETJMP(rval) \
4645
do { \

0 commit comments

Comments
 (0)