1 Star 0 Fork 0

StoneEpigraph / arch.dwm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
util.c 517 Bytes
一键复制 编辑 原始数据 按行查看 历史
Hiltjo Posthuma 提交于 2016-11-05 11:34 . die() on calloc failure
/* See LICENSE file for copyright and license details. */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
void *
ecalloc(size_t nmemb, size_t size)
{
void *p;
if (!(p = calloc(nmemb, size)))
die("calloc:");
return p;
}
void
die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
fputc(' ', stderr);
perror(NULL);
} else {
fputc('\n', stderr);
}
exit(1);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/StoneEpigraph/arch.dwm.git
git@gitee.com:StoneEpigraph/arch.dwm.git
StoneEpigraph
arch.dwm
arch.dwm
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891