-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
26 lines (21 loc) · 871 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2021 echipa SD
/**
* Useful structures/macros
*
* https://ocw.cs.pub.ro/courses/so/laboratoare/resurse/die
*/
#ifndef UTILS_H_
#define UTILS_H_
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
/* useful macro for handling error codes */
#define DIE(assertion, call_description) \
do { \
if (assertion) { \
fprintf(stderr, "(%s, %d): ", __FILE__, __LINE__); \
perror(call_description); \
exit(errno); \
} \
} while (0)
#endif // UTILS_H_