File tree Expand file tree Collapse file tree 7 files changed +26
-12
lines changed
Expand file tree Collapse file tree 7 files changed +26
-12
lines changed Original file line number Diff line number Diff line change 18811881 "git_index_free" : {
18821882 "ignore" : true
18831883 },
1884+ "git_index_get_byindex" : {
1885+ "return" : {
1886+ "ownedByThis" : true
1887+ }
1888+ },
18841889 "git_index_get_bypath" : {
18851890 "args" : {
18861891 "stage" : {
18871892 "isOptional" : true
18881893 }
1894+ },
1895+ "return" : {
1896+ "ownedByThis" : true
18891897 }
18901898 },
18911899 "git_index_new" : {
20352043 },
20362044 "index_entry" : {
20372045 "dependencies" : [
2046+ " ../include/functions/copy.h" ,
20382047 " ../include/functions/free.h"
20392048 ],
20402049 "freeFunctionName" : " git_index_entry_free" ,
2050+ "dupFunction" : " git_index_entry_dup" ,
20412051 "isReturnable" : true ,
20422052 "hasConstructor" : true ,
20432053 "ignoreInit" : true
Original file line number Diff line number Diff line change 99
1010const git_error * git_error_dup (const git_error * arg );
1111const git_oid * git_oid_dup (const git_oid * arg );
12- const git_index_entry * git_index_entry_dup (const git_index_entry * arg );
1312const git_index_time * git_index_time_dup (const git_index_time * arg );
1413const git_time * git_time_dup (const git_time * arg );
1514const git_diff_delta * git_diff_delta_dup (const git_diff_delta * arg );
@@ -19,5 +18,6 @@ git_remote_head *git_remote_head_dup(const git_remote_head *src);
1918
2019void git_time_dup (git_time * * out , const git_time * arg );
2120void git_transfer_progress_dup (git_transfer_progress * * out , const git_transfer_progress * arg );
21+ void git_index_entry_dup (git_index_entry * * dest , const git_index_entry * src );
2222
2323#endif
Original file line number Diff line number Diff line change 99
1010void git_remote_head_free (git_remote_head * remote_head );
1111void git_diff_line_free (const git_diff_line * diff_line );
12- void git_index_entry_free (git_index_entry * index_entry );
12+ void git_index_entry_free (const git_index_entry * index_entry );
1313
1414#endif
Original file line number Diff line number Diff line change 44#include " git2.h"
55#include " git2/diff.h"
66
7+ #include < iostream>
8+
79const git_error *git_error_dup (const git_error *arg) {
810 git_error *result = (git_error *)malloc (sizeof (git_error));
911 result->klass = arg->klass ;
@@ -35,3 +37,11 @@ git_remote_head *git_remote_head_dup(const git_remote_head *src) {
3537 : NULL ;
3638 return dest;
3739}
40+
41+ void git_index_entry_dup (git_index_entry **dest, const git_index_entry *src) {
42+ *dest = (git_index_entry *)malloc (sizeof (git_index_entry));
43+ memcpy (*dest, src, sizeof (git_index_entry));
44+ (*dest)->path = src->path
45+ ? strdup (src->path )
46+ : NULL ;
47+ }
Original file line number Diff line number Diff line change 11#include < cstring>
22
33#include " git2.h"
4+ #include < iostream>
45
56void git_remote_head_free (git_remote_head *remote_head) {
67 free (remote_head->name );
@@ -13,7 +14,7 @@ void git_diff_line_free(const git_diff_line *diff_line) {
1314 free ((void *) diff_line);
1415}
1516
16- void git_index_entry_free (git_index_entry *index_entry) {
17+ void git_index_entry_free (const git_index_entry *index_entry) {
1718 free ((void *)(index_entry->path ));
1819 free ((void *) index_entry);
1920}
Original file line number Diff line number Diff line change 5555
5656 {% elsif field.cppClassName == ' String' %}
5757 if (wrapper->GetValue ()->{{ field.name }}) {
58+ free ((void *)wrapper->GetValue ()->{{ field.name }});
5859 }
5960
6061 Nan::Utf8String str (value);
Original file line number Diff line number Diff line change @@ -115,15 +115,7 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
115115 free ((void *)from_{{ arg.name }});
116116 {%endif%}
117117 {%endif%}
118- {%if not arg.shouldAlloc %}
119- {%if arg.ownedByThis |and arg.dupFunction |and arg.freeFunctionName |and arg.isReturn |and arg.selfFreeing %}
120- // We need to free duplicated memory we are responsible for that we obtained from libgit2 because
121- // nodegit duplicates it again when calling the wrapper
122- if (from_{{ arg.name }} != NULL ) {
123- {{ arg.freeFunctionName }}(from_{{ arg.name }});
124- }
125- {%endif%}
126- {%elsif arg.isReturn %}
118+ {%if arg.shouldAlloc |and arg.isReturn %}
127119 {%if not arg.selfFreeing %}
128120 {%if arg.cppClassName == " GitBuf" %}
129121 {%else %}
You can’t perform that action at this time.
0 commit comments