commit b71e5c6a002e958920758433bec6d7fb9397119a
parent d4d9ac000252b310c889a4d1a9fad2339072b138
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Tue, 12 Jan 2021 23:57:47 +0000
bugfix: genqdyn_n() definition
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/COPYING b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2020 Laurent Bercot <ska-skaware@skarnet.org>
+Copyright (c) 2011-2021 Laurent Bercot <ska-skaware@skarnet.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/src/include/skalibs/genqdyn.h b/src/include/skalibs/genqdyn.h
@@ -22,13 +22,13 @@ extern genqdyn const genqdyn_zero ;
#define GENQDYN_INIT(type, n, d) { .queue = STRALLOC_ZERO, .esize = sizeof(type), .head = 0, .num = n, .den = d }
extern void genqdyn_init (genqdyn *, size_t, unsigned int, unsigned int) ;
-#define genqdyn_n(g) ((g)->queue.len / (g)->esize - (g)->head) ;
+#define genqdyn_n(g) (((g)->queue.len - (g)->head) / (g)->esize)
extern void genqdyn_free (genqdyn *) ;
extern int genqdyn_push (genqdyn *, void const *) ;
extern int genqdyn_unpush (genqdyn *) ;
-#define GENQDYN_PEEK(type, g) ((type *)((g)->queue.s + (g)->esize * (g)->head))
+#define GENQDYN_PEEK(type, g) ((type *)((g)->queue.s + (g)->head))
#define genqdyn_peek(g) GENQDYN_PEEK(void, (g))
-extern int genqdyn_pop(genqdyn *) ;
+extern int genqdyn_pop (genqdyn *) ;
#endif