sbrk.c

来自「mips架构的bootloader,99左右的版本 但源代码现在没人更新了」· C语言 代码 · 共 32 行

C
32
字号
/************************************************************* * File: lib/sbrk.c * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history */#define NULL 0#define ALLOCSIZE 32*1024char allocbuf[ALLOCSIZE];char *allocp1 = allocbuf;/**************************************************************  sbrk() is alloc() on page 101 of K & R  Edition 2*	This sbrk is used by PMON, the sbrk in crt1.s is used*	by clients.*/char *sbrk(n)int n;{	if (allocp1 + n <= allocbuf + ALLOCSIZE) {		allocp1 += n;		return(allocp1 - n);	} else		return(NULL);}

⌨️ 快捷键说明

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