⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alloc.c

📁 早期freebsd实现
💻 C
字号:
/* alloc.c - version 1.0.2 */#ifdef LINT/*   a ridiculous definition, suppressing	"possible pointer alignment problem" for (long *) malloc()	"enlarg defined but never used"	"ftell defined (in <stdio.h>) but never used"   from lint*/#include <stdio.h>long *alloc(n) unsigned n; {long dummy = ftell(stderr);	if(n) dummy = 0;	/* make sure arg is used */	return(&dummy);}#elseextern char *malloc();extern char *realloc();long *alloc(lth)register unsigned lth;{	register char *ptr;	if(!(ptr = malloc(lth)))		panic("Cannot get %d bytes", lth);	return((long *) ptr);}long *enlarge(ptr,lth)register char *ptr;register unsigned lth;{	register char *nptr;	if(!(nptr = realloc(ptr,lth)))		panic("Cannot reallocate %d bytes", lth);	return((long *) nptr);}#endif LINT

⌨️ 快捷键说明

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