📄 sbrk.c
字号:
/*****************************************************************************************
** FILE : Sbrk.C **
** DESCRIPTION : This file is generated by Hitachi Project Generator (Ver.1.2) **
** **
**-------------------------------------------------------------------------------------**
** **
** Copyright (c) 2001-2002 Hitachi Micro Systems Europe Ltd UK. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **
** **
*****************************************************************************************/
#include <stdio.h>
#include "sbrk.h"
//const size_t _sbrk_size= /* Specifies the minimum unit of */
/* the defined heap area */
static union {
long dummy ; /* Dummy for 4-byte boundary */
char heap[HEAPSIZE]; /* Declaration of the area managed */
/* by sbrk */
}heap_area ;
static char *brk=(char *)&heap_area;/* End address of area assigned */
/**************************************************************************/
/* sbrk:Data write */
/* Return value:Start address of the assigned area (Pass) */
/* -1 (Failure) */
/**************************************************************************/
char *sbrk(size_t size) /* Assigned area size */
{
char *p;
if(brk+size>heap_area.heap+HEAPSIZE) /* Empty area size */
return (char *)-1 ;
p=brk ; /* Area assignment */
brk += size ; /* End address update */
return p ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -