-
Notifications
You must be signed in to change notification settings - Fork 170
Support (de)serializing Map and Set objects #483
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
Conversation
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.
Nice!
goto fail; | ||
if (bc_get_leb128(s, &prop_count)) | ||
goto fail; | ||
for(i = 0; i < prop_count; i++) { |
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.
for(i = 0; i < prop_count; i++) { | |
for (i = 0; i < prop_count; i++) { |
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'm merely following the predominant style for for
loops here (of the 533 for statements in quickjs.c, 66.8% are written this way.)
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.
Oh!
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.
Fabrice and i differ on this, I always put a space after if
, for
, while
, switch
, return
with a value etc. Fabrice is less adamant about it :)
JS_FreeValue(ctx, rv); | ||
JS_FreeValue(ctx, argv[0]); | ||
JS_FreeValue(ctx, argv[1]); | ||
argv[0] = JS_UNDEFINED; |
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.
Is this necessary since yoy are about to return?
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.
Yes, because it's inside a loop, otherwise we can end up double-freeing argv[1] on the next iteration.
(And I'm clearing argv[0] for clarity's sake, otherwise a casual reader will stop and think: "Why one and not the other?")
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.
Great!
Fixes: #482