vmalloc

来自「Graphviz - Graph Drawing Programs from A」· 代码 · 共 86 行

TXT
86
字号
##################################################################### This file defines probes for local features that vmalloc requires.# Such probes are interpreted by the "iffe" language interpreter.# Results are stored in the FEATURE directory.# Written by Kiem-Phong Vo (08/15/95).####################################################################lib atexitlib onexitlib getpagesizehdr stathdr stdlibsys stattyp ssize_thdr malloclib malloptlib mallinfolib mstatshdr allocastd	malloc note{ stuck with standard malloc }end noexecute{	_BEGIN_EXTERNS_	extern void _exit _ARG_((int));	extern char* strdup _ARG_((const char*));	#if _STD_	char* malloc(unsigned n) { _exit(0); return 0; }	#else	char* malloc(n) unsigned n; { _exit(0); return 0; }	#endif	_END_EXTERNS_	main() { strdup("yo"); _exit(1); }}endlib alloca note{ alloca exists }end compile{	#if _hdr_alloca	#include	<alloca.h>	#endif	main()	{	alloca(10);	}}endmal alloca note{ alloca is based on malloc() }end execute{	#if _hdr_alloca	#include	<alloca.h>	#endif	#if _STD_	void* malloc(unsigned int size)	#else	void* malloc(size) unsigned int size;	#endif	{	exit(0);		return 0;	}	main()	{	alloca(10);		return 1;	}}endstk down note{ stack grows downward }end execute{	static growdown()	{	static char*	addr = 0;		char		array[4];		if(!addr)		{	addr = &array[0];			return growdown();		}		else if(addr < &array[0])			return 0;		else	return 1;		}	main() { return growdown() ? 0 : 1; }}endexit    cleanup note{ stuck with standard _cleanup }end execute{        #include <stdio.h>        _BEGIN_EXTERNS_        extern void exit _ARG_((int));        extern void _exit _ARG_((int));        extern void _cleanup();        void _cleanup() { _exit(0); }        _END_EXTERNS_        main() { printf("cleanup\n"); exit(1); }}end

⌨️ 快捷键说明

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