mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 18:20:21 +00:00
Rename Array to Vector
Finally get rid of the C style vector, rename the template class to its proper name
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "_resetprop.h"
|
||||
#include "utils.h"
|
||||
#include "array.h"
|
||||
|
||||
/* ***********************************************************************
|
||||
* Auto generated header and constant definitions compiled from
|
||||
@@ -114,7 +113,7 @@ static bool prop_encode(pb_ostream_t *stream, const pb_field_t *field, void * co
|
||||
PersistentProperties_PersistentPropertyRecord prop = {};
|
||||
prop.name.funcs.encode = name_encode;
|
||||
prop.has_value = true;
|
||||
Array<prop_t> &prop_list = *(Array<prop_t> *) *arg;
|
||||
Vector<prop_t> &prop_list = *(Vector<prop_t> *) *arg;
|
||||
for (auto &p : prop_list) {
|
||||
if (!pb_encode_tag_for_field(stream, field))
|
||||
return false;
|
||||
@@ -209,7 +208,7 @@ CharArray persist_getprop(const char *name) {
|
||||
|
||||
bool persist_deleteprop(const char *name) {
|
||||
if (use_pb) {
|
||||
Array<prop_t> prop_list;
|
||||
Vector<prop_t> prop_list;
|
||||
read_cb_t read_cb(collect_props, &prop_list);
|
||||
persist_getprop(&read_cb);
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "resetprop.h"
|
||||
#include "_resetprop.h"
|
||||
#include "utils.h"
|
||||
#include "array.h"
|
||||
#include "flags.h"
|
||||
|
||||
bool use_pb = false;
|
||||
@@ -77,7 +76,7 @@ illegal:
|
||||
|
||||
// Define the way to sort prop_t
|
||||
template<>
|
||||
int(*Array<prop_t>::_cmp)(prop_t&, prop_t&) = [](auto a, auto b) -> int {
|
||||
int(*Vector<prop_t>::_cmp)(prop_t&, prop_t&) = [](auto a, auto b) -> int {
|
||||
return strcmp(a.name, b.name);
|
||||
};
|
||||
|
||||
@@ -90,12 +89,12 @@ static void read_props(const prop_info *pi, void *read_cb) {
|
||||
}
|
||||
|
||||
void collect_props(const char *name, const char *value, void *v_plist) {
|
||||
Array<prop_t> &prop_list = *static_cast<Array<prop_t> *>(v_plist);
|
||||
Vector<prop_t> &prop_list = *static_cast<Vector<prop_t> *>(v_plist);
|
||||
prop_list.push_back(prop_t(name, value));
|
||||
}
|
||||
|
||||
static void collect_unique_props(const char *name, const char *value, void *v_plist) {
|
||||
Array<prop_t> &prop_list = *static_cast<Array<prop_t> *>(v_plist);
|
||||
Vector<prop_t> &prop_list = *static_cast<Vector<prop_t> *>(v_plist);
|
||||
for (auto &prop : prop_list) {
|
||||
if (strcmp(name, prop.name) == 0)
|
||||
return;
|
||||
@@ -113,7 +112,7 @@ static int init_resetprop() {
|
||||
}
|
||||
|
||||
static void print_props(bool persist) {
|
||||
Array<prop_t> prop_list;
|
||||
Vector<prop_t> prop_list;
|
||||
getprop(collect_props, &prop_list, persist);
|
||||
prop_list.sort();
|
||||
for (auto &prop : prop_list)
|
||||
|
Reference in New Issue
Block a user