Sync usage with man page.
[netbsd-mini2440.git] / dist / ntp / libntp / emalloc.c
blob7c86ae1c3a4c189ccb1a86aedb77b393303785c6
1 /* $NetBSD: emalloc.c,v 1.2 2003/12/04 16:23:36 drochner Exp $ */
3 /*
4 * emalloc - return new memory obtained from the system. Belch if none.
5 */
6 #include "ntp_types.h"
7 #include "ntp_malloc.h"
8 #include "ntp_syslog.h"
9 #include "ntp_stdlib.h"
11 #if defined SYS_WINNT && defined DEBUG
12 #include <crtdbg.h>
13 #endif
15 #if defined SYS_WINNT && defined DEBUG
17 void *
18 debug_emalloc(
19 size_t size,
20 char *filename,
21 int line
24 char *mem;
26 if ((mem = (char *)_malloc_dbg(size, _NORMAL_BLOCK, filename, line)) == 0) {
27 msyslog(LOG_ERR, "Exiting: No more memory!");
28 exit(1);
30 return mem;
33 #else
35 void *
36 emalloc(
37 size_t size
40 char *mem;
42 if ((mem = (char *)malloc(size)) == 0) {
43 msyslog(LOG_ERR, "Exiting: No more memory!");
44 exit(1);
46 return mem;
50 #endif