source:
src/examples/gc_no_raii/test/badlll.c@
7527e63
| Last change on this file since 7527e63 was bee4283, checked in by , 9 years ago | |
|---|---|
|
|
| File size: 922 bytes | |
| Rev | Line | |
|---|---|---|
| [9421588a] | 1 | #include "gc.h" |
| 2 | ||
| 3 | struct List_t | |
| 4 | { | |
| 5 | gcpointer(List_t) next; | |
| 6 | int val; | |
| 7 | }; | |
| [f1e42c1] | 8 | |
| [bee4283] | 9 | void ?{}(List_t* this); |
| 10 | List_t* ?=?(List_t* this, List_t* rhs); | |
| 11 | ||
| [f1e42c1] | 12 | typedef gcpointer(List_t) LLL; |
| 13 | ||
| 14 | #define MAX (1024 * 1024) | |
| 15 | ||
| [bee4283] | 16 | // LLL buildLLL(int sz) |
| 17 | void bla() | |
| [f1e42c1] | 18 | { |
| 19 | int i; | |
| [bee4283] | 20 | // LLL ll0;//, lll, llc; |
| 21 | // | |
| 22 | // ll0 = gcmalloc(); | |
| 23 | // ll0->val = 0; | |
| 24 | // lll = ll0; | |
| 25 | // | |
| 26 | // for (i = 1; i < sz; i++) | |
| 27 | // { | |
| 28 | // llc = gcmalloc(); | |
| 29 | // llc->val = i; | |
| 30 | // lll->next = llc; | |
| 31 | // lll = llc; | |
| 32 | // } | |
| 33 | // | |
| 34 | // return ll0; | |
| [bf5a70da] | 35 | } |
| [bee4283] | 36 | // |
| 37 | // void testLLL(LLL lll) | |
| 38 | // { | |
| 39 | // unsigned char *counted; | |
| 40 | // | |
| 41 | // counted = (unsigned char *) calloc(MAX, sizeof(unsigned char)); | |
| 42 | // while (lll) | |
| 43 | // { | |
| 44 | // counted[lll->val]++; | |
| 45 | // if (counted[lll->val] > 1) | |
| 46 | // { | |
| 47 | // fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val); | |
| 48 | // exit(1); | |
| 49 | // } | |
| 50 | // lll = lll->next; | |
| 51 | // } | |
| 52 | // | |
| 53 | // return; | |
| 54 | // } | |
| [bf5a70da] | 55 | |
| 56 | int main(void) | |
| 57 | { | |
| 58 | LLL mylll; | |
| 59 | ||
| [bee4283] | 60 | // mylll = buildLLL(MAX); |
| 61 | // | |
| 62 | // testLLL(mylll); | |
| [bf5a70da] | 63 | |
| 64 | return 0; | |
| 65 | } |
Note:
See TracBrowser
for help on using the repository browser.