/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*********************************************************************** ** ** Name: dbmalloc.c ** ** Description: Testing malloc (OBSOLETE) ** ** Modification History: ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this *test. ** The regress mode will be the default mode. Since the regress tool *limits ** the output to a one line status:PASS or FAIL,all of the printf *statements ** have been handled with an if (debug_mode) statement.
***********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include"nspr.h"
printf("[%s]: starting test 0\n", name);
n = t2(name, 0, debug); if (-1 == n) { return;
}
printf("[%s]: test 0 had %ld allocations.\n", name, n);
if (0 >= n) { return;
}
for (i = 0; i < nf; i++) { int which = rand() % n; if (0 == which) {
printf("[%s]: starting test %d -- no allocation should fail\n", name,
i + 1);
} else {
printf("[%s]: starting test %d -- allocation %d should fail\n", name,
i + 1, which);
}
(void)t2(name, which, debug);
printf("[%s]: test %d done.\n", name, i + 1);
}
return;
}
int main(int argc, char** argv) { int okay = 0; int multithread = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.