Skip to content
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

Drop ctx argument from functions that don't need it #156

Merged
merged 5 commits into from Nov 29, 2023

Conversation

bnoordhuis
Copy link
Contributor

Drop the unused JSContext argument from several oft-used functions.

Non-functional change (strip build/qjs && ls -l build/qjs is the same before and after) but improves legibility, IMO. No change to the public API either.

@saghul
Copy link
Contributor

saghul commented Nov 29, 2023

JS_NewInt32 and js_int32 are the same, what is the reasoning for having "duplicate" implementations? Is it the force-inline?

@saghul
Copy link
Contributor

saghul commented Nov 29, 2023

Shall we drop JS_DupValueRT now?

Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a question.

@bnoordhuis
Copy link
Contributor Author

JS_NewInt32 and js_int32 are the same, what is the reasoning for having "duplicate" implementations? Is it the force-inline?

No, it's purely stylistic / unclutter.

If we're okay with backwards-incompatible API changes, or versioning the API somehow, we could make the change directly to quickjs.h.

Shall we drop JS_DupValueRT now?

Good point! I was meaning to eradicate the two remaining calls from quickjs.c but I forgot. I'll fix that.

As to your general question: it serves no purpose so... yes?

@saghul
Copy link
Contributor

saghul commented Nov 29, 2023

JS_NewInt32 and js_int32 are the same, what is the reasoning for having "duplicate" implementations? Is it the force-inline?

No, it's purely stylistic / unclutter.

If we're okay with backwards-incompatible API changes, or versioning the API somehow, we could make the change directly to quickjs.h.

Shall we drop JS_DupValueRT now?

Good point! I was meaning to eradicate the two remaining calls from quickjs.c but I forgot. I'll fix that.

As to your general question: it serves no purpose so... yes?

I am somewhere near +0.5, I guess if we are doing a new thing might as well drop the baggage? OTOH, having existing compile as-is looks like a big plus, so let's have it!

@bnoordhuis
Copy link
Contributor Author

I'll go ahead and merge this and then ponder for a bit whether or not to change the public API.

@bnoordhuis bnoordhuis merged commit 39c8acd into quickjs-ng:master Nov 29, 2023
24 checks passed
@bnoordhuis bnoordhuis deleted the rm-ctx-arg branch November 29, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants