From b561f9d4b00d23b81a4e83bd9d751148e5969864 Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Fri, 9 Aug 2019 19:26:33 +0300 Subject: [PATCH] Replace gensym_t with struct --- c/flisp.c | 11 ++++++----- c/flisp.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/c/flisp.c b/c/flisp.c index 6b1e6a8..53242f1 100644 --- a/c/flisp.c +++ b/c/flisp.c @@ -323,7 +323,8 @@ value_t fl_gensym(value_t *args, uint32_t nargs) { argcount("gensym", nargs, 0); (void)args; - gensym_t *gs = (gensym_t *)alloc_words(sizeof(gensym_t) / sizeof(void *)); + struct gensym *gs = + (struct gensym *)alloc_words(sizeof(struct gensym) / sizeof(void *)); gs->id = _gensym_ctr++; gs->binding = UNBOUND; gs->isconst = 0; @@ -342,7 +343,7 @@ static value_t fl_gensymp(value_t *args, u_int32_t nargs) char *symbol_name(value_t v) { if (ismanaged(v)) { - gensym_t *gs = (gensym_t *)ptr(v); + struct gensym *gs = (struct gensym *)ptr(v); gsnameno = 1 - gsnameno; char *n = uint2str(gsname[gsnameno] + 1, sizeof(gsname[0]) - 1, gs->id, 10); @@ -522,9 +523,9 @@ static value_t relocate(value_t v) nfn->name = fn->name; return nc; } else if (t == TAG_SYM) { - gensym_t *gs = (gensym_t *)ptr(v); - gensym_t *ng = - (gensym_t *)alloc_words(sizeof(gensym_t) / sizeof(void *)); + struct gensym *gs = (struct gensym *)ptr(v); + struct gensym *ng = + (struct gensym *)alloc_words(sizeof(struct gensym) / sizeof(void *)); ng->id = gs->id; ng->binding = gs->binding; ng->isconst = 0; diff --git a/c/flisp.h b/c/flisp.h index 5c436f1..36ccad8 100644 --- a/c/flisp.h +++ b/c/flisp.h @@ -30,12 +30,12 @@ typedef struct _symbol_t { }; } symbol_t; -typedef struct { +struct gensym { value_t isconst; value_t binding; // global value binding struct _fltype_t *type; uint32_t id; -} gensym_t; +}; #define TAG_NUM 0x0 #define TAG_CPRIM 0x1