diff options
| author | Tyge Løvset <[email protected]> | 2021-09-11 22:58:58 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-11 22:58:58 +0200 |
| commit | a2aa14cc91ccbd42cd1188c6fac6126a38d0de77 (patch) | |
| tree | 843baa1eba7abae70b54326ca898607eedbc5e76 /examples/queue.c | |
| parent | 658019e1e53ad1ccbca5c623b7199c445eab8b86 (diff) | |
| download | STC-modified-a2aa14cc91ccbd42cd1188c6fac6126a38d0de77.tar.gz STC-modified-a2aa14cc91ccbd42cd1188c6fac6126a38d0de77.zip | |
Fixed docs for newstyle.
Diffstat (limited to 'examples/queue.c')
| -rw-r--r-- | examples/queue.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/examples/queue.c b/examples/queue.c index 1e96b53a..dabb0a08 100644 --- a/examples/queue.c +++ b/examples/queue.c @@ -1,15 +1,9 @@ #include <stc/crandom.h>
-#include <stc/cqueue.h>
#include <stdio.h>
-#if 1
-using_cdeq(i, int);
-using_cqueue(i, cdeq_i);
-#else
-#include <stc/clist.h>
-using_clist(i, int);
-using_cqueue(i, clist_i);
-#endif
+#define i_tag i
+#define i_val int
+#include <stc/cqueue.h>
int main() {
int n = 100000000;
@@ -17,7 +11,7 @@ int main() { stc64_t rng = stc64_init(1234);
dist = stc64_uniform_init(0, n);
- c_forvar (cqueue_i queue = cqueue_i_init(), cqueue_i_del(&queue))
+ c_forauto (cqueue_i, queue)
{
// Push ten million random numbers onto the queue.
c_forrange (n)
@@ -25,7 +19,7 @@ int main() { // Push or pop on the queue ten million times
printf("%d\n", n);
- c_forrange (n) { // range uses initial n only.
+ c_forrange (n) { // forrange uses initial n only.
int r = stc64_uniform(&rng, &dist);
if (r & 1)
++n, cqueue_i_push(&queue, r);
|
