diff --git a/native/jni/daemon/bootstages.cpp b/native/jni/daemon/bootstages.cpp index 20735471f..819f92128 100644 --- a/native/jni/daemon/bootstages.cpp +++ b/native/jni/daemon/bootstages.cpp @@ -362,9 +362,7 @@ static void simple_mount(const char *path) { if (access(buf2, F_OK) == -1) continue; if (entry->d_type == DT_DIR) { - char *new_path = strdup2(buf2); - simple_mount(new_path); - delete [] new_path; + simple_mount(CharArray(buf2)); } else if (entry->d_type == DT_REG) { // Actual file path snprintf(buf, PATH_MAX, "%s%s", SIMPLEMOUNT, buf2); diff --git a/native/jni/include/daemon.h b/native/jni/include/daemon.h index 866309062..15f377c5d 100644 --- a/native/jni/include/daemon.h +++ b/native/jni/include/daemon.h @@ -9,10 +9,6 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - extern int setup_done; extern int seperate_vendor; @@ -88,8 +84,4 @@ void magiskhide_handler(int client); void su_daemon_handler(int client, struct ucred *credential); -#ifdef __cplusplus -} -#endif - #endif diff --git a/native/jni/include/img.h b/native/jni/include/img.h index e48281612..089b9b2c1 100644 --- a/native/jni/include/img.h +++ b/native/jni/include/img.h @@ -1,10 +1,6 @@ #ifndef IMG_H #define IMG_H -#ifdef __cplusplus -extern "C" { -#endif - int create_img(const char *img, int size); int resize_img(const char *img, int size); char *mount_image(const char *img, const char *target); @@ -12,8 +8,4 @@ int umount_image(const char *target, const char *device); int merge_img(const char *source, const char *target); int trim_img(const char *img, const char *mount, char *loop); -#ifdef __cplusplus -} -#endif - #endif //IMG_H diff --git a/native/jni/include/magisk.h b/native/jni/include/magisk.h index 0e595988d..3c3a7d0d1 100644 --- a/native/jni/include/magisk.h +++ b/native/jni/include/magisk.h @@ -6,10 +6,6 @@ #include "logging.h" -#ifdef __cplusplus -extern "C" { -#endif - #define MAIN_SOCKET "d30138f2310a9fb9c54a3e0c21f58591" #define LOG_SOCKET "5864cd77f2f8c59b3882e2d35dbf51e4" #define JAVA_PACKAGE_NAME "com.topjohnwu.magisk" @@ -45,10 +41,8 @@ extern "C" { extern char *argv0; /* For changing process name */ -#define applet_names ((const char *[]) { "magisk", "su", "resetprop", "magiskhide", "imgtool", NULL }) -#define init_applet ((const char *[]) { "magiskpolicy", "supolicy", NULL }) - -extern int (*applet_main[]) (int, char *[]); +#define applet_names ((const char *[]) { "magisk", "su", "resetprop", "magiskhide", "imgtool", nullptr }) +#define init_applet ((const char *[]) { "magiskpolicy", "supolicy", nullptr }) // Multi-call entrypoints int magisk_main(int argc, char *argv[]); @@ -58,8 +52,4 @@ int su_client_main(int argc, char *argv[]); int resetprop_main(int argc, char *argv[]); int imgtool_main(int argc, char *argv[]); -#ifdef __cplusplus -} -#endif - #endif diff --git a/native/jni/misc/applets.cpp b/native/jni/misc/applets.cpp index 96018e31a..4d6d8a888 100644 --- a/native/jni/misc/applets.cpp +++ b/native/jni/misc/applets.cpp @@ -7,8 +7,8 @@ #include "magisk.h" #include "selinux.h" -int (*applet_main[]) (int, char *[]) = - { magisk_main, su_client_main, resetprop_main, magiskhide_main, imgtool_main, NULL }; +static int (*applet_main[]) (int, char *[]) = + { magisk_main, su_client_main, resetprop_main, magiskhide_main, imgtool_main, nullptr }; char *argv0;