Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 78 additions & 9 deletions generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
"out": {
"isReturn": true,
"cppClassName": "GitBuf",
"jsClassName": "Buffer"
"jsClassName": "Buffer",
"shouldAlloc": true
},
"blob": {
"cppClassName": "GitBlob",
Expand Down Expand Up @@ -259,7 +260,8 @@
"isReturn": true,
"cppClassName": "GitBuf",
"jsClassName": "Buffer",
"cType": "git_buf *"
"cType": "git_buf *",
"shouldAlloc": true
},
"repo": {
"cppClassName": "GitRepository",
Expand Down Expand Up @@ -307,9 +309,9 @@
"jsFunctionName": "grow",
"args": {
"buffer": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
"isReturn": false,
"isSelf": true,
"shouldAlloc": false
}
},
"return": {
Expand All @@ -324,9 +326,9 @@
"jsFunctionName": "set",
"args": {
"buffer": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
"isReturn": false,
"isSelf": true,
"shouldAlloc": false
},
"data": {
"cppClassName": "Buffer",
Expand Down Expand Up @@ -537,6 +539,19 @@
"return": {
"ownedByThis": true
}
},
"git_commit_header_field": {
"isAsync": true,
"args": {
"out": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
}
},
"return": {
"isErrorCode": true
}
}
}
},
Expand Down Expand Up @@ -601,6 +616,12 @@
},
"git_config_get_string_buf": {
"isAsync": true,
"args": {
"out": {
"isReturn": true,
"shouldAlloc": true
}
},
"return": {
"isErrorCode": true
}
Expand Down Expand Up @@ -673,6 +694,19 @@
"return": {
"isErrorCode": true
}
},
"git_config_find_programdata": {
"isAsync": true,
"return": {
"isErrorCode": true
},
"args": {
"out": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
}
}
}
},
"dependencies": [
Expand Down Expand Up @@ -882,6 +916,19 @@
"git_diff_status_char": {
"ignore": true
},
"git_diff_to_buf": {
"isAsync": true,
"return": {
"isErrorCode": true
},
"args": {
"out": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
}
}
},
"git_diff_tree_to_index": {
"args": {
"old_tree": {
Expand Down Expand Up @@ -1968,7 +2015,9 @@
"isAsync": true,
"args": {
"out": {
"isReturn": true
"isReturn": true,
"shouldAlloc": true,
"isSelf": false
},
"remote": {
"isSelf": true
Expand Down Expand Up @@ -2115,6 +2164,13 @@
"isAsync": true,
"return": {
"isErrorCode": true
},
"args": {
"out": {
"isReturn": true,
"isSelf": false,
"shouldAlloc": true
}
}
},
"git_repository_init_init_options": {
Expand Down Expand Up @@ -2478,6 +2534,19 @@
"isErrorCode": true
}
},
"git_submodule_resolve_url": {
"isAsync": true,
"args": {
"out": {
"isReturn": true,
"shouldAlloc": true,
"isSelf": false
}
},
"return": {
"isErrorCode": true
}
},
"git_submodule_update": {
"isAsync": true,
"args": {
Expand Down
14 changes: 3 additions & 11 deletions generate/templates/partials/async_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
{%if arg.globalPayload %}
{{ cppFunctionName }}_globalPayload* globalPayload = new {{ cppFunctionName }}_globalPayload;
{%endif%}
{%if arg.cppClassName == "GitBuf" %}
{%if cppFunctionName == "Set"%}
baton->{{arg.name}} = Nan::ObjectWrap::Unwrap<{{ arg.cppClassName }}>(info.This())->GetValue();
{%else%}
baton->{{arg.name}} = ({{ arg.cType }})malloc(sizeof({{ arg.cType|replace '*' '' }}));
baton->{{arg.name}}->ptr = NULL;
baton->{{arg.name}}->size = baton->{{arg.name}}->asize = 0;
{%endif%}
{%endif%}
{%endeach%}

{%each args|argsInfo as arg %}
Expand Down Expand Up @@ -61,9 +52,10 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
{%endif%}
{%endif%}
{%elsif arg.shouldAlloc %}
baton->{{arg.name}} = ({{ arg.cType }})malloc(sizeof({{ arg.cType|replace '*' '' }}));
{%if arg.cppClassName == "GitBuf" %}
{%else%}
baton->{{ arg.name }} = ({{ arg.cType }})malloc(sizeof({{ arg.cType|replace '*' '' }}));
baton->{{arg.name}}->ptr = NULL;
baton->{{arg.name}}->size = baton->{{arg.name}}->asize = 0;
{%endif%}
{%endif%}
{%endeach%}
Expand Down
4 changes: 4 additions & 0 deletions generate/templates/partials/convert_to_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@

to = tmpArray;
{% elsif cppClassName == 'GitBuf' %}
{% if doNotConvert %}
to = Nan::Null();
{% else %}
if ({{= parsedName =}}) {
to = Nan::New<String>({{= parsedName =}}->ptr, {{= parsedName = }}->size).ToLocalChecked();
}
else {
to = Nan::Null();
}
{% endif %}
{% else %}
{% if copy %}
if ({{= parsedName =}} != NULL) {
Expand Down
Loading