2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 08:45:22 +00:00

Add SWIG renames for fields to preserve backcompat

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
Ryan Lee
2024-09-30 12:56:06 -07:00
parent 3f5180527d
commit e2c407c614
2 changed files with 24 additions and 2 deletions

View File

@@ -48,12 +48,23 @@ typedef enum
AA_RECORD_STATUS /* Configuration change */
} aa_record_event_type;
#ifndef __cplusplus
/*
* Use this preprocessor dance to maintain backcompat for field names
* This will break C code that used the C++ reserved keywords "namespace"
* and "class" as identifiers, but this is bad practice anyways, and we
* hope that we are the only ones in a given C file that messed up this way
*
* TODO: document this in a man page for aalogparse?
*/
#if defined(SWIG) && defined(__cplusplus)
#error "SWIG and __cplusplus are defined together"
#elif !defined(SWIG) && !defined(__cplusplus)
/* Use SWIG's %rename feature to preserve backcompat */
#define class rule_class
#define namespace aa_namespace
#endif
typedef struct
typedef struct aa_log_record
{
aa_record_syntax_version version;
aa_record_event_type event; /* Event type */