summaryrefslogtreecommitdiffstats
path: root/util.h
blob: a1c47e615caeb13e122c4b0df9e7759777949cef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once

#include <stdio.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define ARRLEN(x) (sizeof(x)/sizeof((x)[0]))

#define ASSERT(x) assert((x), __FILE__, __LINE__, #x)

int strnwidth(const char *s, int n);
void assert(int cond, const char *file, int line, const char *condstr);

char *sanitized(const char *instr);

char *aprintf(const char *fmtstr, ...);