Changeset bf5a70da for src/examples
- Timestamp:
- May 18, 2016, 12:36:20 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 85951a6
- Parents:
- f1e42c1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/gc_no_raii/test/badlll.c
rf1e42c1 rbf5a70da 15 15 int i; 16 16 LLL ll0, lll, llc; 17 ctor(&ll0);18 ctor(&lll);19 ctor(&llc);20 17 21 18 ll0 = gcmalloc(); … … 23 20 lll = ll0; 24 21 22 for (i = 1; i < sz; i++) 23 { 24 llc = gcnew<List_t>(); 25 llc->val = i; 26 lll->next = llc; 27 lll = llc; 28 } 29 25 30 return ll0; 26 31 } 32 33 void testLLL(LLL lll) 34 { 35 unsigned char *counted; 36 37 counted = (unsigned char *) calloc(MAX, sizeof(unsigned char)); 38 while (lll) 39 { 40 counted[lll->val]++; 41 if (counted[lll->val] > 1) 42 { 43 fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val); 44 exit(1); 45 } 46 lll = lll->next; 47 } 48 49 return; 50 } 51 52 int main(void) 53 { 54 LLL mylll; 55 56 mylll = buildLLL(MAX); 57 58 testLLL(mylll); 59 60 return 0; 61 }
Note: See TracChangeset
for help on using the changeset viewer.