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