1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
TP-Link_Archer-XR500v/EN7526G_3.18Kernel_SDK/apps/public/linux-atm/qgen/common.c
2024-07-22 01:58:46 -03:00

48 lines
642 B
C
Executable File

/* common.c - Common functions */
/* Written 1995 by Werner Almesberger, EPFL-LRC */
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "common.h"
void *alloc(size_t size)
{
void *n;
n = malloc(size);
if (n) return n;
perror("malloc");
exit(1);
}
char *stralloc(const char *str)
{
char *n;
n = strdup(str);
if (n) return n;
perror("malloc");
exit(1);
}
void die(const char *fmt,...)
{
va_list ap;
fflush(stdout);
va_start(ap,fmt);
vfprintf(stderr,fmt,ap);
va_end(ap);
fputc('\n',stderr);
exit(1);
}