From 4e7dafb0e4ab3c21d83411671a7a154e3c44039d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 13 Apr 2019 02:43:43 -0400 Subject: [PATCH] Use bitset instead of vector --- native/jni/magiskhide/proc_monitor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/native/jni/magiskhide/proc_monitor.cpp b/native/jni/magiskhide/proc_monitor.cpp index 437ed3241..be6b47a63 100644 --- a/native/jni/magiskhide/proc_monitor.cpp +++ b/native/jni/magiskhide/proc_monitor.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -44,8 +45,8 @@ static map> uid_proc_map; /* uid -> list of process */ pthread_mutex_t monitor_lock; #define PID_MAX 32768 -static vector attaches(PID_MAX); /* true if pid is monitored */ -static vector detaches(PID_MAX); /* true if tid should be detached */ +static bitset attaches; /* true if pid is monitored */ +static bitset detaches; /* true if tid should be detached */ /******** * Utils @@ -242,8 +243,8 @@ static void term_thread(int) { uid_proc_map.clear(); zygote_map.clear(); hide_set.clear(); - std::fill(attaches.begin(), attaches.end(), false); - std::fill(detaches.begin(), detaches.end(), false); + attaches.reset(); + detaches.reset(); // Misc hide_enabled = false; pthread_mutex_destroy(&monitor_lock);