Add RConfig.{get,set}_b dummy APIs

This commit is contained in:
pancake 2021-02-05 17:21:03 +01:00 committed by pancake
parent 8413fd630a
commit ebed292f66
2 changed files with 15 additions and 1 deletions

View File

@ -323,10 +323,14 @@ R_API bool r_config_toggle(RConfig *cfg, const char *name) {
eprintf ("(error: '%s' config key is read only)\n", name);
return false;
}
(void)r_config_set_i (cfg, name, !node->i_value);
(void)r_config_set_b (cfg, name, !node->i_value);
return true;
}
R_API bool r_config_get_b(RConfig *cfg, const char *name) {
return r_config_get_i (cfg, name) != 0;
}
R_API ut64 r_config_get_i(RConfig *cfg, const char *name) {
RConfigNode *node = r_config_node_get (cfg, name);
if (node) {
@ -516,6 +520,14 @@ R_API void r_config_node_value_format_i(char *buf, size_t buf_size, const ut64 i
}
}
R_API RConfigNode* r_config_set_b(RConfig *cfg, const char *name, bool b) {
RConfigNode *node = r_config_node_get (cfg, name);
if (node && r_config_node_is_bool (node)) {
return r_config_set_i (cfg, name, b? 1: 0);
}
return NULL;
}
R_API RConfigNode* r_config_set_i(RConfig *cfg, const char *name, const ut64 i) {
char buf[128], *ov = NULL;
r_return_val_if_fail (cfg && name, NULL);

View File

@ -74,6 +74,8 @@ R_API void r_config_free(RConfig *cfg);
R_API void r_config_lock(RConfig *cfg, bool lock);
R_API bool r_config_eval(RConfig *cfg, const char *str, bool many);
R_API void r_config_bump(RConfig *cfg, const char *key);
R_API bool r_config_get_b(RConfig *cfg, const char *name) {
R_API RConfigNode* r_config_set_b(RConfig *cfg, const char *name, bool b);
R_API RConfigNode *r_config_set_i(RConfig *cfg, const char *name, const ut64 i);
R_API RConfigNode *r_config_set_cb(RConfig *cfg, const char *name, const char *value, RConfigCallback cb);
R_API RConfigNode *r_config_set_i_cb(RConfig *cfg, const char *name, int ivalue, RConfigCallback cb);