Skip to content

Commit 357336b

Browse files
committed
Rewrites (and makes static) findptrsbuffer to avoid multiple conversions between Lisp and native pointers
1 parent 1ffd1ba commit 357336b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

inc/gcfinaldefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define GCFINALDEFS_H 1
33
#include "lispemul.h" /* for LispPTR, DLword */
44
void printarrayblock(LispPTR base);
5-
LispPTR findptrsbuffer(LispPTR ptr);
65
LispPTR releasingvmempage(LispPTR ptr);
76
LispPTR checkarrayblock(LispPTR base, LispPTR free, LispPTR onfreelist);
87
LispPTR deleteblock(LispPTR base);

src/gcfinal.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,16 @@ static int integerlength(unsigned int n) {
138138
/* */
139139
/************************************************************************/
140140

141-
LispPTR findptrsbuffer(LispPTR ptr) {
142-
struct buf *bptr;
143-
bptr = (struct buf *)NativeAligned4FromLAddr(*System_Buffer_List_word);
144-
while (LAddrFromNative(bptr) != NIL) {
145-
if (ptr == bptr->vmempage)
146-
return (LAddrFromNative(bptr));
147-
else
148-
bptr = (struct buf *)NativeAligned4FromLAddr(bptr->sysnext);
141+
static LispPTR findptrsbuffer(LispPTR ptr) {
142+
LispPTR buf;
143+
struct buf *buf_np;
144+
buf = *System_Buffer_List_word;
145+
while (buf != NIL) {
146+
buf_np = (struct buf *)NativeAligned4FromLAddr(buf);
147+
if (ptr == buf_np->vmempage) {
148+
return (buf);
149+
}
150+
buf = buf_np->sysnext;
149151
}
150152
return (NIL);
151153
}

0 commit comments

Comments
 (0)