Use dynamic_bitset.emplace_back()

This commit is contained in:
topjohnwu 2022-02-11 01:00:58 -08:00
parent f6d765bf81
commit 55ed6109c1
2 changed files with 15 additions and 12 deletions

View File

@ -93,6 +93,9 @@ public:
slot_type get_slot(size_t slot) const { slot_type get_slot(size_t slot) const {
return slot_list.size() > slot ? slot_list[slot].to_ulong() : 0ul; return slot_list.size() > slot ? slot_list[slot].to_ulong() : 0ul;
} }
void emplace_back(slot_type l) {
slot_list.emplace_back(l);
}
protected: protected:
slot_bits::reference get(size_t pos) { slot_bits::reference get(size_t pos) {
size_t slot = pos / slot_size; size_t slot = pos / slot_size;

View File

@ -367,13 +367,14 @@ static void get_process_info(int client, const sock_cred *cred) {
// Collect module status from system_server // Collect module status from system_server
int slots = read_int(client); int slots = read_int(client);
int id = 0; dynamic_bitset bits;
for (int i = 0; i < slots; ++i) { for (int i = 0; i < slots; ++i) {
dynamic_bitset::slot_type l = 0; dynamic_bitset::slot_type l = 0;
xxread(client, &l, sizeof(l)); xxread(client, &l, sizeof(l));
dynamic_bitset::slot_bits bits(l); bits.emplace_back(l);
for (int j = 0; id < module_list->size(); ++j, ++id) { }
if (!bits[j]) { for (int id = 0; id < module_list->size(); ++id) {
if (!as_const(bits)[id]) {
// Either not a zygisk module, or incompatible // Either not a zygisk module, or incompatible
char buf[4096]; char buf[4096];
snprintf(buf, sizeof(buf), MODULEROOT "/%s/zygisk", snprintf(buf, sizeof(buf), MODULEROOT "/%s/zygisk",
@ -384,7 +385,6 @@ static void get_process_info(int client, const sock_cred *cred) {
} }
} }
} }
}
} }
static void send_log_pipe(int fd) { static void send_log_pipe(int fd) {