New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add null to pj and use for relocs #15776
Conversation
libr/core/cbin.c
Outdated
if (relname && *relname) { | ||
pj_ks (pj, "name", relname); | ||
} else { | ||
pj_knull (pj, "name"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about not showing this field just in case there's no name, programatically it will be handled the same when parsing it and it is how its done in other places in r2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not be handled the same in almost all parsers. But whether it is better in this case to omit the entire name or use null is a subjective question. If you prefer to have it removed, I can do that.
@@ -28,13 +28,15 @@ 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont like to use "null" here wwhen all the other cases have 1 letter to define the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propose a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
I cant. Thats why i didnt :D
… On 8 Jan 2020, at 14:14, Florian Märkl ***@***.***> wrote:
@thestr4ng3r commented on this pull request.
In libr/include/r_util/pj.h:
> @@ -28,13 +28,15 @@ 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);
propose a better name
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I prefer removal. But this conflicts with json schemas i think
… On 8 Jan 2020, at 14:16, Florian Märkl ***@***.***> wrote:
@thestr4ng3r commented on this pull request.
In libr/core/cbin.c:
> @@ -1616,7 +1616,11 @@ 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);
+ } else {
+ pj_knull (pj, "name");
It will not be handled the same in almost all parsers. But whether it is better in this case to omit the entire name or use null is a subjective question. If you prefer to have it removed, I can do that.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I don't know the exact specification of json schema, but I am pretty sure it is possible to model both optional fields and nullable fields with it. |
"N/A"
makes no sense in json