mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Add SWIG renames for fields to preserve backcompat
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
parent
3f5180527d
commit
e2c407c614
2 changed files with 24 additions and 2 deletions
|
@ -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 */
|
||||
|
|
|
@ -55,6 +55,17 @@ warnings.warn("free_record is now a no-op as the record's memory is handled auto
|
|||
*/
|
||||
%ignore free_record;
|
||||
|
||||
|
||||
/*
|
||||
* Map names to preserve backwards compatibility
|
||||
*/
|
||||
#ifdef SWIGPYTHON
|
||||
%rename("_class") aa_log_record::rule_class;
|
||||
#else
|
||||
%rename("class") aa_log_record::rule_class;
|
||||
#endif
|
||||
%rename("namespace") aa_log_record::aa_namespace;
|
||||
|
||||
%include <aalogparse.h>
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue