|
2 | 2 | #include "git2_exception.h" |
3 | 3 | #include "git2_reference.h" |
4 | 4 | #include "git2_commit.h" |
| 5 | +#include "git2_tree.h" |
| 6 | +#include "git2_blob.h" |
5 | 7 |
|
6 | 8 | static zend_class_entry *php_git2_reference_ce; |
7 | 9 | static zend_object_handlers php_git2_reference_handler; |
@@ -68,7 +70,7 @@ static PHP_METHOD(Reference, resolve) { |
68 | 70 | RETURN_FALSE; |
69 | 71 | } |
70 | 72 |
|
71 | | - git2_reference_spawn(&return_value, out TSRMLS_CC); |
| 73 | + git2_reference_spawn(return_value, out TSRMLS_CC); |
72 | 74 | } |
73 | 75 |
|
74 | 76 | ZEND_BEGIN_ARG_INFO_EX(arginfo_reference_peel, 0, 0, 1) |
@@ -102,19 +104,25 @@ static PHP_METHOD(Reference, peel) { |
102 | 104 | // TODO find object type, instanciate |
103 | 105 | switch(git_object_type(out)) { |
104 | 106 | case GIT_OBJ_COMMIT: |
105 | | - git2_commit_spawn(&return_value, (git_commit*)out TSRMLS_CC); |
| 107 | + git2_commit_spawn(return_value, (git_commit*)out TSRMLS_CC); |
| 108 | + return; |
| 109 | + case GIT_OBJ_TREE: |
| 110 | + git2_tree_spawn(return_value, (git_tree*)out TSRMLS_CC); |
| 111 | + return; |
| 112 | + case GIT_OBJ_BLOB: |
| 113 | + git2_blob_spawn(return_value, (git_blob*)out TSRMLS_CC); |
106 | 114 | return; |
107 | 115 | default: |
108 | 116 | git2_throw_exception(0 TSRMLS_CC, "Type of object is not implemented"); |
109 | 117 | return; |
110 | 118 | } |
111 | 119 | } |
112 | 120 |
|
113 | | -void git2_reference_spawn(zval **return_value, git_reference *ref TSRMLS_DC) { |
| 121 | +void git2_reference_spawn(zval *return_value, git_reference *ref TSRMLS_DC) { |
114 | 122 | git2_reference_object_t *intern; |
115 | 123 |
|
116 | | - object_init_ex(*return_value, php_git2_reference_ce); |
117 | | - intern = (git2_reference_object_t*)Z_OBJ_P(*return_value); |
| 124 | + object_init_ex(return_value, php_git2_reference_ce); |
| 125 | + intern = (git2_reference_object_t*)Z_OBJ_P(return_value); |
118 | 126 | intern->ref = ref; |
119 | 127 | } |
120 | 128 |
|
|
0 commit comments