mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 18:17:09 +00: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
@ -48,12 +48,23 @@ typedef enum
|
|||||||
AA_RECORD_STATUS /* Configuration change */
|
AA_RECORD_STATUS /* Configuration change */
|
||||||
} aa_record_event_type;
|
} 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 class rule_class
|
||||||
#define namespace aa_namespace
|
#define namespace aa_namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct aa_log_record
|
||||||
{
|
{
|
||||||
aa_record_syntax_version version;
|
aa_record_syntax_version version;
|
||||||
aa_record_event_type event; /* Event type */
|
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;
|
%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>
|
%include <aalogparse.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user