mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-13 18:32:56 +00:00
Use pj api in core/config (#13047)
This commit is contained in:
parent
7803f4685c
commit
4c4df8cf81
@ -118,8 +118,12 @@ static void rasm2_list(RCore *core, const char *arch, int fmt) {
|
||||
char bits[32];
|
||||
RAsmPlugin *h;
|
||||
RListIter *iter;
|
||||
PJ *pj = pj_new ();
|
||||
if (!pj) {
|
||||
return;
|
||||
}
|
||||
if (fmt == 'j') {
|
||||
r_cons_print ("{");
|
||||
pj_o (pj);
|
||||
}
|
||||
r_list_foreach (a->plugins, iter, h) {
|
||||
if (arch && *arch) {
|
||||
@ -165,10 +169,18 @@ static void rasm2_list(RCore *core, const char *arch, int fmt) {
|
||||
if (fmt == 'q') {
|
||||
r_cons_println (h->name);
|
||||
} else if (fmt == 'j') {
|
||||
const char *str_bits = "32, 64";
|
||||
const char *license = "GPL";
|
||||
r_cons_printf ("\"%s\":{\"bits\":[%s],\"license\":\"%s\",\"description\":\"%s\",\"features\":\"%s\"}%s",
|
||||
h->name, str_bits, license, h->desc, feat, iter->n? ",": "");
|
||||
pj_k (pj, h->name);
|
||||
pj_o (pj);
|
||||
pj_k (pj, "bits");
|
||||
pj_a (pj);
|
||||
pj_i (pj, 32);
|
||||
pj_i (pj, 64);
|
||||
pj_end (pj);
|
||||
pj_ks (pj, "license", license);
|
||||
pj_ks (pj, "description", h->desc);
|
||||
pj_ks (pj, "features", feat);
|
||||
pj_end (pj);
|
||||
} else {
|
||||
r_cons_printf ("%s%s %-9s %-11s %-7s %s\n",
|
||||
feat, feat2, bits, h->name,
|
||||
@ -177,7 +189,9 @@ static void rasm2_list(RCore *core, const char *arch, int fmt) {
|
||||
}
|
||||
}
|
||||
if (fmt == 'j') {
|
||||
r_cons_print ("}\n");
|
||||
pj_end (pj);
|
||||
r_cons_println (pj_string (pj));
|
||||
pj_free (pj);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user