deleteprop -> delprop
This commit is contained in:
parent
a0998009c1
commit
cf54cad3ce
@ -1,6 +1,3 @@
|
|||||||
/* resetprop.h - API for resetprop
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -10,5 +7,5 @@ int prop_exist(const char *name);
|
|||||||
int setprop(const char *name, const char *value, bool trigger = true);
|
int setprop(const char *name, const char *value, bool trigger = true);
|
||||||
std::string getprop(const char *name, bool persist = false);
|
std::string getprop(const char *name, bool persist = false);
|
||||||
void getprop(void (*callback)(const char *, const char *, void *), void *cookie, bool persist = false);
|
void getprop(void (*callback)(const char *, const char *, void *), void *cookie, bool persist = false);
|
||||||
int deleteprop(const char *name, bool persist = false);
|
int delprop(const char *name, bool persist = false);
|
||||||
void load_prop_file(const char *filename, bool trigger = true);
|
void load_prop_file(const char *filename, bool trigger = true);
|
||||||
|
@ -71,7 +71,7 @@ illegal:
|
|||||||
" -n set properties without init triggers\n"
|
" -n set properties without init triggers\n"
|
||||||
" only affects setprop\n"
|
" only affects setprop\n"
|
||||||
" -p access actual persist storage\n"
|
" -p access actual persist storage\n"
|
||||||
" only affects getprop and deleteprop\n"
|
" only affects getprop and delprop\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
, arg0);
|
, arg0);
|
||||||
@ -172,7 +172,7 @@ int setprop(const char *name, const char *value, bool trigger) {
|
|||||||
auto pi = (prop_info*) __system_property_find(name);
|
auto pi = (prop_info*) __system_property_find(name);
|
||||||
if (pi != nullptr) {
|
if (pi != nullptr) {
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
if (strncmp(name, "ro.", 3) == 0) deleteprop(name);
|
if (strncmp(name, "ro.", 3) == 0) delprop(name);
|
||||||
ret = __system_property_set(name, value);
|
ret = __system_property_set(name, value);
|
||||||
} else {
|
} else {
|
||||||
ret = __system_property_update(pi, value, strlen(value));
|
ret = __system_property_update(pi, value, strlen(value));
|
||||||
@ -195,13 +195,13 @@ int setprop(const char *name, const char *value, bool trigger) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int deleteprop(const char *name, bool persist) {
|
int delprop(const char *name, bool persist) {
|
||||||
if (!check_legal_property_name(name))
|
if (!check_legal_property_name(name))
|
||||||
return 1;
|
return 1;
|
||||||
ENSURE_INIT(-1);
|
ENSURE_INIT(-1);
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
LOGD("resetprop: deleteprop [%s]\n", name);
|
LOGD("resetprop: delprop [%s]\n", name);
|
||||||
if (persist && strncmp(name, "persist.", 8) == 0)
|
if (persist && strncmp(name, "persist.", 8) == 0)
|
||||||
persist = persist_deleteprop(name);
|
persist = persist_deleteprop(name);
|
||||||
return __system_property_del(name) && !(persist && strncmp(name, "persist.", 8) == 0);
|
return __system_property_del(name) && !(persist && strncmp(name, "persist.", 8) == 0);
|
||||||
@ -235,7 +235,7 @@ int resetprop_main(int argc, char *argv[]) {
|
|||||||
load_prop_file(argv[1], trigger);
|
load_prop_file(argv[1], trigger);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strcmp(argv[0], "--delete") == 0 && argc == 2) {
|
} else if (strcmp(argv[0], "--delete") == 0 && argc == 2) {
|
||||||
return deleteprop(argv[1], persist);
|
return delprop(argv[1], persist);
|
||||||
} else if (strcmp(argv[0], "--help") == 0) {
|
} else if (strcmp(argv[0], "--help") == 0) {
|
||||||
usage(argv0);
|
usage(argv0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user