emalloc.c

来自「网络时间协议NTP 源码 版本v4.2.0b 该源码用于linux平台下」· C语言 代码 · 共 49 行

C
49
字号
/* * emalloc - return new memory obtained from the system.  Belch if none. */#include "ntp_types.h"#include "ntp_malloc.h"#include "ntp_syslog.h"#include "ntp_stdlib.h"#if defined SYS_WINNT && defined DEBUG#include <crtdbg.h>#endif#if defined SYS_WINNT && defined DEBUGvoid *debug_emalloc(	u_int size,	char *filename,	int line	){	char *mem;	if ((mem = (char *)_malloc_dbg(size, _NORMAL_BLOCK, filename, line)) == 0) {		msyslog(LOG_ERR, "Exiting: No more memory!");		exit(1);	}	return mem;}#elsevoid *emalloc(	u_int size	){	char *mem;	if ((mem = (char *)malloc(size)) == 0) {		msyslog(LOG_ERR, "Exiting: No more memory!");		exit(1);	}	return mem;}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?