Aria

A low-level systems programming language
git clone git://git.m21c.me/Aria.git
Log | Files | Refs | LICENSE

commit 46c999dcf0b4531ddc2701966f403ecbeec79d3f
parent 1330e3e1855e91a1f755f10c628860b8706595fe
Author: m21c <ho*******@gmail.com>
Date:   Fri, 27 Jun 2025 18:36:48 +0200

moved listappend

Diffstat:
Mcompiler.c | 39+++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/compiler.c b/compiler.c @@ -26,28 +26,6 @@ myassert(const char *expr, const char *file, int line) typedef unsigned char uchar; typedef unsigned int uint; -#define listappendex(parent, child, head, tail, prev, next) do { \ - if ((parent)->head) { \ - assert((parent)->tail); \ - (child)->prev = (parent)->tail; \ - (child)->next = NULL; \ - (parent)->tail->next = (child); \ - } else { \ - assert(!(parent)->tail); \ - (child)->prev = NULL; \ - (child)->next = NULL; \ - (parent)->head = (child); \ - } \ - (parent)->tail = (child); \ -} while (0) - -#define listappend(parent, child) \ - listappendex(parent, child, head, tail, prev, next) - - - -/* SECTION: - forward declarations - */ - typedef struct Node Node; @@ -842,6 +820,23 @@ const uint8_t opinfo[] = { // @section utility functions {{{ +#define listappendex(parent, child, head, tail, prev, next) do { \ + if ((parent)->head) { \ + assert((parent)->tail); \ + (child)->prev = (parent)->tail; \ + (child)->next = NULL; \ + (parent)->tail->next = (child); \ + } else { \ + assert(!(parent)->tail); \ + (child)->prev = NULL; \ + (child)->next = NULL; \ + (parent)->head = (child); \ + } \ + (parent)->tail = (child); \ +} while (0) + +#define listappend(parent, child) \ + listappendex(parent, child, head, tail, prev, next) #ifndef lengthof #define lengthof(array) ((int) sizeof(array) / (int) sizeof(*(array)))