]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
4733607e ZJS |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2015 Zbigniew Jędrzejewski-Szmek | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
8bb3626d | 23 | #include "macro.h" |
4733607e ZJS |
24 | |
25 | const char *audit_type_to_string(int type); | |
26 | int audit_type_from_string(const char *s); | |
8bb3626d ZJS |
27 | |
28 | /* This is inspired by DNS TYPEnnn formatting */ | |
29 | #define audit_type_name_alloca(type) \ | |
30 | ({ \ | |
31 | const char *_s_; \ | |
32 | _s_ = audit_type_to_string(type); \ | |
33 | if (!_s_) { \ | |
34 | _s_ = alloca(strlen("AUDIT") + DECIMAL_STR_MAX(int)); \ | |
35 | sprintf((char*) _s_, "AUDIT%04i", type); \ | |
36 | } \ | |
37 | _s_; \ | |
38 | }) |