]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Replace __BEGIN_DECLS and __END_DECLS with extern "C". 53/head
authorAnthony G. Basile <blueness@gentoo.org>
Tue, 6 Jul 2021 13:54:47 +0000 (07:54 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 6 Jul 2021 14:38:52 +0000 (08:38 -0600)
The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
glibc and uClibc, but not musl.  We replace them by the more general
extern "C" { ... } block exposed only if we have __cplusplus.

Forward ported from a patch by Anthony G. Basile <blueness@gentoo.org>.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
include/libcgroup/config.h
include/libcgroup/error.h
include/libcgroup/groups.h
include/libcgroup/init.h
include/libcgroup/iterators.h
include/libcgroup/log.h
include/libcgroup/tasks.h
src/bindings/libcgroup.p
src/daemon/cgrulesengd.h
src/libcgroup-internal.h
src/tools/tools-common.h

index 9aaa39032a8bf8e6e9b862e4b5def32b098311b4..f8350092dc5c31e54b5148cbbe6cf10dc4f49daa 100644 (file)
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_config 5. Configuration
@@ -128,6 +130,8 @@ int cgroup_config_create_template_group(
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /*_LIBCGROUP_CONFIG_H*/
index 1dfdde9d7ba7d6d6f51a5580ac0fb78f0cd2a5ae..14a6e16818c0a241cc173a3e8b86113a9e01c94a 100644 (file)
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_errors 6. Error handling
@@ -99,6 +101,8 @@ int cgroup_get_last_errno(void);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_INIT_H */
index 201558f69c60cff2ab97bf102c7af66f94af7f67..39ec3cd13544e13a47973b91d1ad6e19e2601cce 100644 (file)
@@ -11,7 +11,9 @@
 #include <stdbool.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Flags for cgroup_delete_cgroup_ext().
@@ -587,6 +589,8 @@ char *cgroup_get_cgroup_name(struct cgroup *cgroup);
  */
 
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_GROUPS_H */
index 5150f2fc38eb7aea344190bdc32ba92c823b687c..ea2dcc98bc60868fb22bff0461345514053df4ea 100644 (file)
@@ -9,7 +9,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_init 1. Initialization
@@ -58,6 +60,8 @@ int cgroup_get_subsys_mount_point(const char *controller, char **mount_point);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_INIT_H */
index c6d453d6419196b72f1dfc249dcc0c9cabb51faa..b3ba3af74c1260a6073ca54cd1c41819a3347a2d 100644 (file)
@@ -11,7 +11,9 @@
 #include <features.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_iterators 3. Iterators
@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(void **handle);
  * @}
  */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_ITERATORS_H */
index 0dd03b41dad1a294f95257e1f5cf635f6fb07bed..f69347378c2609c3b223a920c3e682b970f0026a 100644 (file)
@@ -11,7 +11,9 @@
 
 #include <stdarg.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * @defgroup group_log 7. Logging
@@ -142,6 +144,8 @@ extern int cgroup_parse_log_level_str(const char *levelstr);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_LOG_H */
index aad438a22e07bfea960c6907048c867778d55b07..8553c30a5581fa0c60d12a190ea3bc07f2a1fe3a 100644 (file)
@@ -12,7 +12,9 @@
 #include <stdbool.h>
 #endif
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** Flags for cgroup_change_cgroup_uid_gid(). */
 enum cgflags {
@@ -204,6 +206,8 @@ int cgroup_register_unchanged_process(pid_t pid, int flags);
  * @}
  * @}
  */
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _LIBCGROUP_TASKS_H */
index ebbbcdc229d61ef8d43efc686fcd1fdba33ac8d1..ed3f32fd66ad7951117681223d524a271ac3cc93 100644 (file)
@@ -3,14 +3,6 @@
 #include "libcgroup.h"
 %}
 
-#ifdef  __cplusplus
-#define __BEGIN_DECLS   extern "C" {
-#define __END_DECLS     }
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
 %include typemaps.i
 %include cpointer.i
 %pointer_functions(int, intp);
index e273b4bcefe49e7d40621485fcaa0e40e50eb442..0b120762ae503e3cc5d18b411092c35fc4cdb1e0 100644 (file)
@@ -17,7 +17,9 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "config.h"
 #include "libcgroup.h"
@@ -119,7 +121,9 @@ void cgre_flash_templates(int signum);
  */
 void cgre_catch_term(int signum);
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* _CGRULESENGD_H */
 
index 1dfc92b5b51b6ac45d32f050b0d223347288800c..edc5abb9bdf63e2b25293cb2a4e5386660a1909d 100644 (file)
@@ -16,7 +16,9 @@
 
 #define __LIBCG_INTERNAL
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #include "config.h"
 #include <dirent.h>
@@ -407,6 +409,8 @@ int cgroupv2_controller_enabled(const char * const cg_name,
 
 #endif /* UNIT_TEST */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif
index 292c408e0d270f2ee154e74c32c26a1de4db8a90..e3541b17fda7f59937ea96011ddaf878a3bbe82c 100644 (file)
@@ -18,7 +18,9 @@
 
 #define __TOOLS_COMMON
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 #include "config.h"
 #include <libcgroup.h>
 #include "../libcgroup-internal.h"
@@ -136,6 +138,8 @@ int parse_r_flag(const char * const program_name,
 
 #endif /* UNIT_TEST */
 
-__END_DECLS
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
 
 #endif /* TOOLS_COMMON */