cazan

azan with c
git clone https://git.afify.dev/cazan.git
Log | Files | Refs

util.h (638B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #ifndef UTIL_H
      4 #define UTIL_H
      5 
      6 #define MAX(A, B)               ((A) > (B) ? (A) : (B))
      7 #define MIN(A, B)               ((A) < (B) ? (A) : (B))
      8 #define LEN(A)                  (sizeof(A)/sizeof(A[0]))
      9 #define BETWEEN(X, A, B)        ((A) <= (X) && (X) <= (B))
     10 #define FAIL_IF(EXP, MSG)       {if(EXP){fprintf(stderr, "[\033[31mFAILED %d\033[0m] %s\n", __LINE__, MSG);exit(EXIT_FAILURE);}}
     11 #define PERROR(EXP)              {if(EXP){print_error(strerror(errno));}};
     12 
     13 void *ecalloc(size_t, size_t);
     14 void *erealloc(void*, size_t);
     15 void die(const char *fmt, ...);
     16 
     17 #endif /* UTIL_H */