aboutsummaryrefslogtreecommitdiff
path: root/include/util.h
blob: 722e6d38e4c2720331f0b89f2d84335b021429a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef CERC_UTIL_H
#define CERC_UTIL_H
#include <stddef.h>
#include "lex.h"

enum exit_status {
	/* EXIT_SUCCESS = 0 (defined in stdlib.h) */
	EXIT_USER = 1,
	EXIT_LEX = 2,
	EXIT_PARSE = 3,
	EXIT_CHECK = 4,
	EXIT_ABNORMAL = 255,
};

void *must_malloc(size_t size);
void *must_calloc(size_t nmemb, size_t size);
void *must_realloc(void *ptr, size_t size);
void error(struct location loc, const char *fmt, ...);

#endif