ref: 0ddd26de786eb67b38bc7a6fa371e7d3a87725db
parent: da15cf29739f5dc7f1699d561a8e388c391dffc0
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Dec 24 13:35:17 EST 2024
symbol_t: remove dlcache, set the binding instead
--- a/cvalues.c
+++ b/cvalues.c
@@ -836,11 +836,10 @@
BUILTIN("builtin", builtin)
{
argcount(nargs, 1);
- symbol_t *name = tosymbol(args[0]);
- cvalue_t *cv;
- if(ismanaged(args[0]) || (cv = name->dlcache) == nil)
- lerrorf(FL(ArgError), "function %s not found", name->name);
- return tagptr(cv, TAG_CVALUE);
+ symbol_t *s = tosymbol(args[0]);
+ if(!iscbuiltin(s->binding))
+ lerrorf(FL(ArgError), "function %s not found", s->name);
+ return s->binding;
}
value_t
@@ -854,10 +853,11 @@
*(builtin_t*)cv->data = f;
value_t sym = symbol(name, false);
- ((symbol_t*)ptr(sym))->dlcache = cv;
+ symbol_t *s = ((symbol_t*)ptr(sym));
+ s->binding = tagptr(cv, TAG_CVALUE);
ptrhash_put(&FL(reverse_dlsym_lookup_table), cv, (void*)sym);
- return tagptr(cv, TAG_CVALUE);
+ return s->binding;
}
#define cv_intern(tok) \
--- a/flisp.h
+++ b/flisp.h
@@ -59,7 +59,6 @@
typedef struct _symbol_t {
fltype_t *type;
const char *name;
- void *dlcache; // dlsym address
struct _symbol_t *left;
struct _symbol_t *right;
value_t binding; // global value binding