-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.h
More file actions
23 lines (19 loc) · 803 Bytes
/
helpers.h
File metadata and controls
23 lines (19 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef _HELPERS_H
#define _HELPERS_H 1
#include <stdio.h>
#include <stdlib.h>
/*
* Macro de verificare a erorilor
* Exemplu:
* int fd = open (file_name , O_RDONLY);
* DIE( fd == -1, "open failed");
*/
#define DIE(assertion, call_description) \
do { \
if (assertion) { \
fprintf(stderr, "(%s, %d): ", __FILE__, __LINE__); \
perror(call_description); \
exit(EXIT_FAILURE); \
} \
} while (0)
#endif