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

WIP: Schema #82

Closed
wants to merge 8 commits into from
Closed

WIP: Schema #82

wants to merge 8 commits into from

Conversation

creationix
Copy link
Member

The idea here is to go through all the user-facing functions and organize them into 3 sections.

1 - Declare all local variables at the top
2 - Check the arguments against a static schema
3 - Perform the action being aware of early exits and cleanup of resources.

There are quite a few memory leaks that are only triggered by various error cases. This refactor should fix most if not all of them.

int64_t len = luaL_checkinteger(L, 2);
int64_t offset = luaL_checkinteger(L, 3);
uv_file file;
int64_t len, offset;
Copy link
Member

Choose a reason for hiding this comment

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

uint64_t?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just trying to match what libuv is expecting to go through minimal typecasts.
offset declared at https://github.com/joyent/libuv/blob/a4f88760be1838603fe2eae89a651066cc42eedd/include/uv.h#L1072
though I got size wrong, it should be unsigned int from https://github.com/joyent/libuv/blob/a4f88760be1838603fe2eae89a651066cc42eedd/include/uv.h#L416

Copy link
Member

Choose a reason for hiding this comment

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

k. that sounds reasonable.

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