| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <stdio.h> /* IWYU pragma: keep */ |
| 5 |
|
| 6 |
#include "sd-forward.h" |
| 7 |
|
| 8 |
#include "alloc-util.h" /* IWYU pragma: keep */ |
| 9 |
|
| 10 |
DECLARE_STRING_TABLE_LOOKUP(audit_type, int); |
| 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_) { \ |
| 18 |
_s_ = newa(char, STRLEN("AUDIT") + DECIMAL_STR_MAX(int)); \ |
| 19 |
sprintf((char*) _s_, "AUDIT%04i", type); \ |
| 20 |
} \ |
| 21 |
_s_; \ |
| 22 |
}) |