diff options
Diffstat (limited to 'intern/guardedalloc/test/simpletest/memtest.c')
-rw-r--r-- | intern/guardedalloc/test/simpletest/memtest.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c index c4e0203c21d..2ab3653b435 100644 --- a/intern/guardedalloc/test/simpletest/memtest.c +++ b/intern/guardedalloc/test/simpletest/memtest.c @@ -1,5 +1,4 @@ -/** - * +/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -53,10 +52,10 @@ int main(int argc, char *argv[]) /* ----------------------------------------------------------------- */ switch (argc) { - case 2: + case 2: verbose = atoi(argv[1]); if (verbose < 0) verbose = 0; - break; + break; case 1: default: verbose = 0; @@ -70,7 +69,7 @@ int main(int argc, char *argv[]) /* ----------------------------------------------------------------- */ /* flush mem lib output to stderr */ MEM_set_error_callback(mem_error_cb); - + for (i = 0; i < NUM_BLOCKS; i++) { int blocksize = 10000; char tagstring[1000]; @@ -92,7 +91,7 @@ int main(int argc, char *argv[]) else { fprintf(stderr, "|--* Memory tested as good (as it should be)\n|\n"); } - } + } for (i = 0; i < NUM_BLOCKS; i++) { MEM_freeN(p[i]); @@ -117,11 +116,11 @@ int main(int argc, char *argv[]) for (i = 0; i< 1000; i++,ip++) *ip = i+1; ip = (int*) p[6]; *(ip+10005) = 0; - + retval = MEM_consistency_check(); /* the test should have failed */ - error_status |= !retval; + error_status |= !retval; if (verbose) { if (retval) { fprintf(stderr, "|--* Memory test failed (as it should be)\n"); @@ -129,8 +128,8 @@ int main(int argc, char *argv[]) else { fprintf(stderr, "|--* Memory test FAILED to find corrupted blocks \n"); } - } - + } + for (i = 0; i < NUM_BLOCKS; i++) { MEM_freeN(p[i]); } @@ -139,7 +138,7 @@ int main(int argc, char *argv[]) if (verbose && error_status) { fprintf(stderr,"|--* Memory was corrupted\n"); } - /* ----------------------------------------------------------------- */ + /* ----------------------------------------------------------------- */ if (verbose) { if (error_status) { fprintf(stderr,"|\n|--* Errors were detected\n"); @@ -147,10 +146,8 @@ int main(int argc, char *argv[]) else { fprintf(stderr,"|\n|--* Test exited succesfully\n"); } - + fprintf(stderr,"|\n*** Finished test\n\n"); } return error_status; } - - |