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

📄 alloc.c

📁 spice中支持多层次元件模型仿真的可单独运行的插件源码
💻 C
字号:
/**********Copyright 1990 Regents of the University of California.  All rights reserved.**********//* * Memory alloction functions */#include "spice.h"#include "stdio.h"#include "misc.h"#include "suffix.h"/* Malloc num bytes and initialize to zero. Fatal error if the space can't * be malloc'd.   Return NULL for a request for 0 bytes. */char *tmalloc(num)    int num;{    char *s;    if (!num)	return NULL;    s = malloc((unsigned) num);    if (!s) {        fprintf(stderr, 		"malloc: Internal Error: can't allocate %d bytes.\n", num);        exit(EXIT_BAD);    }    bzero(s, num);    return(s);}char *trealloc(str, num)    char *str;    int num;{    char *s;    if (!num) {	if (str)		free(str);	return NULL;    }    if (!str)	s = tmalloc(num);    else        s = realloc(str, (unsigned) num);    if (!s) {        fprintf(stderr, 		"realloc: Internal Error: can't allocate %d bytes.\n", num);        exit(EXIT_BAD);    }    return(s);}voidtxfree(ptr)	char	*ptr;{	if (ptr)		free(ptr);}

⌨️ 快捷键说明

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