Revert "usbd - Do not start moused by default when a usb mouse is connected"
[dragonfly.git] / contrib / sendmail-8.14 / libsm / t-heap.c
blob7ddb60d2ccb1689f8cd1992b9787d5d0d5be375c
1 /*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 */
10 #include <sm/gen.h>
11 SM_IDSTR(id, "@(#)$Id: t-heap.c,v 1.10 2001/09/11 04:04:49 gshapiro Exp $")
13 #include <sm/debug.h>
14 #include <sm/heap.h>
15 #include <sm/io.h>
16 #include <sm/test.h>
17 #include <sm/xtrap.h>
19 #if SM_HEAP_CHECK
20 extern SM_DEBUG_T SmHeapCheck;
21 # define HEAP_CHECK sm_debug_active(&SmHeapCheck, 1)
22 #else /* SM_HEAP_CHECK */
23 # define HEAP_CHECK 0
24 #endif /* SM_HEAP_CHECK */
26 int
27 main(argc, argv)
28 int argc;
29 char **argv;
31 void *p;
33 sm_test_begin(argc, argv, "test heap handling");
34 if (argc > 1)
35 sm_debug_addsettings_x(argv[1]);
37 p = sm_malloc(10);
38 SM_TEST(p != NULL);
39 p = sm_realloc_x(p, 20);
40 SM_TEST(p != NULL);
41 p = sm_realloc(p, 30);
42 SM_TEST(p != NULL);
43 if (HEAP_CHECK)
45 sm_dprintf("heap with 1 30-byte block allocated:\n");
46 sm_heap_report(smioout, 3);
49 if (HEAP_CHECK)
51 sm_free(p);
52 sm_dprintf("heap with 0 blocks allocated:\n");
53 sm_heap_report(smioout, 3);
54 sm_dprintf("xtrap count = %d\n", SmXtrapCount);
57 #if DEBUG
58 /* this will cause a core dump */
59 sm_dprintf("about to free %p for the second time\n", p);
60 sm_free(p);
61 #endif /* DEBUG */
63 return sm_test_end();