aboutsummaryrefslogtreecommitdiffstats
path: root/afb-helpers-utils.h
blob: d180f08e337971685472fdc14d3fe13516213b4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef AFB_HELPERS_UTILS_H
#define AFB_HELPERS_UTILS_H

#include <limits.h>

#define xstr(s) str(s)
#define str(s) #s

/* with gcc >= 7.2.0, this macro is useful when printing an int with snprintf:
 *
 * char[INT_STR_MAX]; // smaller value leads to a warning
 * snprintf(targetS, sizeof (targetS), "%d", target);
 * */

#define INT_STR_MAX sizeof(xstr(INT_MAX))

#endif /* AFB_HELPERS_UTILS_H */