]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
4733607e ZJS |
2 | #pragma once |
3 | ||
4 | /*** | |
96b2fb93 | 5 | Copyright © 2015 Zbigniew Jędrzejewski-Szmek |
4733607e ZJS |
6 | ***/ |
7 | ||
8bb3626d | 8 | #include "macro.h" |
4733607e ZJS |
9 | |
10 | const char *audit_type_to_string(int type); | |
11 | int audit_type_from_string(const char *s); | |
8bb3626d ZJS |
12 | |
13 | /* This is inspired by DNS TYPEnnn formatting */ | |
14 | #define audit_type_name_alloca(type) \ | |
15 | ({ \ | |
16 | const char *_s_; \ | |
17 | _s_ = audit_type_to_string(type); \ | |
18 | if (!_s_) { \ | |
fbd0b64f | 19 | _s_ = alloca(STRLEN("AUDIT") + DECIMAL_STR_MAX(int)); \ |
8bb3626d ZJS |
20 | sprintf((char*) _s_, "AUDIT%04i", type); \ |
21 | } \ | |
22 | _s_; \ | |
23 | }) |