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

📄 alloc.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include <u.h>#include <libc.h>#include <bin.h>#include <httpd.h>/* * memory allocators: * h routines call canalloc; they should be used by everything else * note this memory is wiped out at the start of each new request * note: these routines probably shouldn't fatal. */char*hstrdup(HConnect *c, char *s){	char *t;	int n;	n = strlen(s) + 1;	t = binalloc(&c->bin, n, 0);	if(t == nil)		sysfatal("out of memory");	memmove(t, s, n);	return t;}void*halloc(HConnect *c, ulong n){	void *p;	p = binalloc(&c->bin, n, 1);	if(p == nil)		sysfatal("out of memory");	return p;}

⌨️ 快捷键说明

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