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

📄 cppalloc.c

📁 gcc库的原代码,对编程有很大帮助.
💻 C
字号:
/* Part of CPP library.  (memory allocation - xmalloc etc)   Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.   Written by Per Bothner, 1994.   Based on CCCP program by by Paul Rubin, June 1986   Adapted to ANSI C, Richard Stallman, Jan 1987This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 2, or (at your option) anylater version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them.   Help stamp out software-hoarding!  */#include "config.h"static voidmemory_full (){  fatal ("Memory exhausted.");}char *xmalloc (size)     unsigned size;{  register char *ptr = (char *) malloc (size);  if (ptr != 0) return (ptr);  memory_full ();  /*NOTREACHED*/  return 0;}char *xrealloc (old, size)     char *old;     unsigned size;{  register char *ptr = (char *) realloc (old, size);  if (ptr == 0)    memory_full ();  return ptr;}char *xcalloc (number, size)     unsigned number, size;{  register unsigned total = number * size;  register char *ptr = (char *) calloc (number, size);  if (ptr == 0)    memory_full ();  return ptr;}

⌨️ 快捷键说明

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