]>
Commit | Line | Data |
---|---|---|
52ad194e | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
e3bff60a MP |
2 | #pragma once |
3 | ||
6e866b33 MB |
4 | #include <alloca.h> |
5 | #include <stdio.h> | |
6 | ||
e3bff60a MP |
7 | #include "macro.h" |
8 | ||
9 | const char *audit_type_to_string(int type); | |
10 | int audit_type_from_string(const char *s); | |
11 | ||
12 | /* This is inspired by DNS TYPEnnn formatting */ | |
13 | #define audit_type_name_alloca(type) \ | |
14 | ({ \ | |
15 | const char *_s_; \ | |
16 | _s_ = audit_type_to_string(type); \ | |
17 | if (!_s_) { \ | |
52ad194e | 18 | _s_ = alloca(STRLEN("AUDIT") + DECIMAL_STR_MAX(int)); \ |
e3bff60a MP |
19 | sprintf((char*) _s_, "AUDIT%04i", type); \ |
20 | } \ | |
21 | _s_; \ | |
22 | }) |