📄 check_error.c
字号:
#include "config.h"#include <stdarg.h>#include <stdlib.h>#include <string.h>#include <stdio.h>#include <errno.h>#include "check_error.h"void eprintf (const char *fmt, const char *file, int line, ...){ va_list args; fflush(stderr); fprintf(stderr,"%s:%d: ",file,line); va_start(args, line); vfprintf(stderr, fmt, args); va_end(args); /*include system error information if format ends in colon */ if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':') fprintf(stderr, " %s", strerror(errno)); fprintf(stderr, "\n"); exit(2);}void *emalloc (size_t n){ void *p; p = malloc(n); if (p == NULL) eprintf("malloc of %u bytes failed:", __FILE__, __LINE__, n); return p;}void *erealloc (void * ptr, size_t n){ void *p; p = realloc (ptr, n); if (p == NULL) eprintf("realloc of %u bytes failed:", __FILE__, __LINE__, n); return p;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -