aboutsummaryrefslogtreecommitdiffstats
path: root/unlist.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-06-10 20:34:32 +0200
committerMattias Andrée <maandree@kth.se>2022-06-10 20:34:32 +0200
commit056c5fe698f194c3187b9eec5378c441930c005b (patch)
treefc918970dcb3576774754c990af230b4dbab02e9 /unlist.c
parentAdd strto[u]{hh,h,z}, strto{i,u}{,8,16,32,64} (diff)
downloadlibsimple-056c5fe698f194c3187b9eec5378c441930c005b.tar.gz
libsimple-056c5fe698f194c3187b9eec5378c441930c005b.tar.bz2
libsimple-056c5fe698f194c3187b9eec5378c441930c005b.tar.xz
Remove `static` from some `static inline`
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--unlist.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/unlist.c b/unlist.c
new file mode 100644
index 0000000..192fad0
--- /dev/null
+++ b/unlist.c
@@ -0,0 +1,50 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+#ifndef TEST
+
+
+extern inline void libsimple_unlist(void *, size_t, size_t *, size_t);
+
+
+#else
+#include "test.h"
+
+int
+main(void)
+{
+ char buf[10];
+ int intarray[10];
+ size_t i, n;
+
+ for (i = 0, n = 10; i < n; i++)
+ buf[i] = i;
+ LIBSIMPLE_UNLIST(buf, 4, &n);
+ LIBSIMPLE_UNLIST(buf, 9 - 1, &n);
+ LIBSIMPLE_UNLIST(buf, 6 - 1, &n);
+ assert(n == 7);
+ assert(buf[0] == 0);
+ assert(buf[1] == 1);
+ assert(buf[2] == 2);
+ assert(buf[3] == 3);
+ assert(buf[4] == 5);
+ assert(buf[5] == 7);
+ assert(buf[6] == 8);
+
+ for (i = 0, n = 10; i < n; i++)
+ intarray[i] = i;
+ LIBSIMPLE_UNLIST(intarray, 4, &n);
+ LIBSIMPLE_UNLIST(intarray, 9 - 1, &n);
+ LIBSIMPLE_UNLIST(intarray, 6 - 1, &n);
+ assert(n == 7);
+ assert(intarray[0] == 0);
+ assert(intarray[1] == 1);
+ assert(intarray[2] == 2);
+ assert(intarray[3] == 3);
+ assert(intarray[4] == 5);
+ assert(intarray[5] == 7);
+ assert(intarray[6] == 8);
+
+ return 0;
+}
+
+#endif