nse_malloc.c
来自「操作系统SunOS 4.1.3版本的源码」· C语言 代码 · 共 54 行
C
54 行
#ifndef lintstatic char sccsid[] = "@(#)nse_malloc.c 1.1 92/07/30 Copyr 1988 Sun Micro";#endif/* * Copyright (c) 1988 Sun Microsystems, Inc. */#include <stdio.h>#include <nse/param.h>/* * Check the results of malloc() and calloc() and exit with an error * message if the desired space can't be allocated. */char *nse_malloc(size) unsigned size;{ char *data; data = malloc(size); if (data != NULL) return data; else { fprintf(stderr, "malloc(%u) failed (Out of swap space?)\n", size); exit(1); /* NOTREACHED */ }}char *nse_calloc(nelem, elsize) unsigned nelem; unsigned elsize;{ char *data; data = calloc(nelem, elsize); if (data != NULL) return data; else { fprintf(stderr, "calloc(%u, %u) failed (Out of swap space?)\n", nelem, elsize); exit(1); /* NOTREACHED */ }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?