Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use type safe pointer instead of void * for New#957

Merged
johnhaley81 merged 1 commit intonodegit:masternodegit/nodegit:masterfrom
srajko:new-type-safetysrajko/nodegit:new-type-safetyCopy head branch name to clipboard
Mar 18, 2016
Merged

Use type safe pointer instead of void * for New#957
johnhaley81 merged 1 commit intonodegit:masternodegit/nodegit:masterfrom
srajko:new-type-safetysrajko/nodegit:new-type-safetyCopy head branch name to clipboard

Conversation

@srajko
Copy link
Collaborator

@srajko srajko commented Mar 18, 2016

Ran into this as part of #955.

Changing the raw pointer from void * to const {{ cType }} * to add type safety. The change actually caught a problem in struct_content.cc where we were sometimes taking the address of a pointer and passing that in instead of the pointer (for git_checkout_options.baseline, we were sending in a git_tree ** instead of a git_tree * to New).

{% if field.hasConstructor |or field.isLibgitType %}
Local<Object> {{ field.name }}Temp = {{ field.cppClassName }}::New(
&this->raw->{{ field.name }},
{%if not field.cType|isPointer %}&{%endif%}this->raw->{{ field.name }},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yikes...

@johnhaley81
Copy link
Collaborator

👍 to type safety. Thanks @srajko

johnhaley81 added a commit that referenced this pull request Mar 18, 2016
Use type safe pointer instead of void * for New
@johnhaley81 johnhaley81 merged commit 2054e3a into nodegit:master Mar 18, 2016
@johnhaley81 johnhaley81 deleted the new-type-safety branch March 18, 2016 20:03
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.