mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-01 18:57:20 +00:00
Add null to pj and use for relocs (#15776)
* Add pj_null() and pj_knull() * Print reloc name as null in json if not available * Omit reloc name in json
This commit is contained in:
parent
c591e7b1a1
commit
4b02315717
@ -1616,7 +1616,9 @@ static int bin_relocs(RCore *r, int mode, int va) {
|
||||
}
|
||||
|
||||
// check if name is available
|
||||
pj_ks (pj, "name", (relname && strcmp (relname, "")) ? relname : "N/A");
|
||||
if (relname && *relname) {
|
||||
pj_ks (pj, "name", relname);
|
||||
}
|
||||
pj_ks (pj, "demname", mn ? mn : "");
|
||||
pj_ks (pj, "type", bin_reloc_type_name (reloc));
|
||||
pj_kn (pj, "vaddr", reloc->vaddr);
|
||||
|
@ -28,6 +28,7 @@ R_API PJ *pj_o(PJ *j);
|
||||
R_API PJ *pj_a(PJ *j);
|
||||
/* keys, values */
|
||||
R_API PJ *pj_k(PJ *j, const char *k);
|
||||
R_API PJ *pj_knull(PJ *j, const char *k);
|
||||
R_API PJ *pj_kn(PJ *j, const char *k, ut64 n);
|
||||
R_API PJ *pj_kN(PJ *j, const char *k, st64 n);
|
||||
R_API PJ *pj_ks(PJ *j, const char *k, const char *v);
|
||||
@ -35,6 +36,7 @@ R_API PJ *pj_ki(PJ *j, const char *k, int d);
|
||||
R_API PJ *pj_kd(PJ *j, const char *k, double d);
|
||||
R_API PJ *pj_kf(PJ *j, const char *k, float d);
|
||||
R_API PJ *pj_kb(PJ *j, const char *k, bool v);
|
||||
R_API PJ *pj_null(PJ *j);
|
||||
R_API PJ *pj_b(PJ *j, bool v);
|
||||
R_API PJ *pj_s(PJ *j, const char *k);
|
||||
R_API PJ *pj_n(PJ *j, ut64 n);
|
||||
|
@ -102,6 +102,13 @@ R_API PJ *pj_k(PJ *j, const char *k) {
|
||||
return j;
|
||||
}
|
||||
|
||||
R_API PJ *pj_knull(PJ *j, const char *k) {
|
||||
r_return_val_if_fail (j && k, j);
|
||||
pj_k (j, k);
|
||||
pj_null (j);
|
||||
return j;
|
||||
}
|
||||
|
||||
R_API PJ *pj_kn(PJ *j, const char *k, ut64 n) {
|
||||
r_return_val_if_fail (j && k, j);
|
||||
pj_k (j, k);
|
||||
@ -152,6 +159,12 @@ R_API PJ *pj_kb(PJ *j, const char *k, bool v) {
|
||||
return j;
|
||||
}
|
||||
|
||||
R_API PJ *pj_null(PJ *j) {
|
||||
r_return_val_if_fail (j, j);
|
||||
pj_raw (j, "null");
|
||||
return j;
|
||||
}
|
||||
|
||||
R_API PJ *pj_b(PJ *j, bool v) {
|
||||
r_return_val_if_fail (j, j);
|
||||
pj_comma (j);
|
||||
|
Loading…
x
Reference in New Issue
Block a user