Skip to content

Commit 0f55800

Browse files
committed
removed use of _PP spawn return_value, added Git2\Tree::entry_bypath()
1 parent 16e0339 commit 0f55800

16 files changed

+68
-34
lines changed

git2_blob.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ static PHP_METHOD(Blob, rawcontent) {
109109
RETURN_STRINGL((const char*)res, len);
110110
}
111111

112-
void git2_blob_spawn(zval **return_value, git_blob *blob TSRMLS_DC) {
112+
void git2_blob_spawn(zval *return_value, git_blob *blob TSRMLS_DC) {
113113
git2_blob_object_t *intern;
114114

115-
object_init_ex(*return_value, php_git2_blob_ce);
116-
intern = (git2_blob_object_t*)Z_OBJ_P(*return_value);
115+
object_init_ex(return_value, php_git2_blob_ce);
116+
intern = (git2_blob_object_t*)Z_OBJ_P(return_value);
117117
intern->blob = blob;
118118
}
119119

git2_blob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
void git2_blob_init(TSRMLS_DC);
55

6-
void git2_blob_spawn(zval **return_value, git_blob *blob TSRMLS_DC);
6+
void git2_blob_spawn(zval *return_value, git_blob *blob TSRMLS_DC);
77

88
#endif /* GIT2_BLOB_H */

git2_commit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ static PHP_METHOD(Commit, tree) {
148148
return;
149149
}
150150

151-
git2_tree_spawn(&return_value, out);
151+
git2_tree_spawn(return_value, out);
152152
}
153153

154-
void git2_commit_spawn(zval **return_value, git_commit *commit TSRMLS_DC) {
154+
void git2_commit_spawn(zval *return_value, git_commit *commit TSRMLS_DC) {
155155
git2_commit_object_t *intern;
156156

157-
object_init_ex(*return_value, php_git2_commit_ce);
158-
intern = (git2_commit_object_t*)Z_OBJ_P(*return_value);
157+
object_init_ex(return_value, php_git2_commit_ce);
158+
intern = (git2_commit_object_t*)Z_OBJ_P(return_value);
159159
intern->commit = commit;
160160
}
161161

git2_commit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#define GIT2_COMMIT_H
33

44
void git2_commit_init(TSRMLS_DC);
5-
void git2_commit_spawn(zval **return_value, git_commit *commit TSRMLS_DC);
5+
void git2_commit_spawn(zval *return_value, git_commit *commit TSRMLS_DC);
66

77
#endif /* GIT2_COMMIT_H */

git2_config.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static PHP_METHOD(Config, get_entry) {
3535
RETURN_NULL();
3636
}
3737

38-
git2_config_entry_spawn(&return_value, e);
38+
git2_config_entry_spawn(return_value, e);
3939
}
4040

4141
ZEND_BEGIN_ARG_INFO_EX(arginfo_config_export, 0, 0, 0)
@@ -88,11 +88,11 @@ static PHP_METHOD(Config, set_string) {
8888
RETURN_TRUE;
8989
}
9090

91-
void git2_config_spawn(zval **return_value, git_config *config TSRMLS_DC) {
91+
void git2_config_spawn(zval *return_value, git_config *config TSRMLS_DC) {
9292
git2_config_object_t *intern;
9393

94-
object_init_ex(*return_value, php_git2_config_ce);
95-
intern = (git2_config_object_t*)Z_OBJ_P(*return_value);
94+
object_init_ex(return_value, php_git2_config_ce);
95+
intern = (git2_config_object_t*)Z_OBJ_P(return_value);
9696
intern->config = config;
9797
}
9898

git2_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
void git2_config_init(TSRMLS_DC);
55

6-
void git2_config_spawn(zval **return_value, git_config *config TSRMLS_DC);
6+
void git2_config_spawn(zval *return_value, git_config *config TSRMLS_DC);
77

88
#endif /* GIT2_CONFIG_H */

git2_config_entry.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ typedef struct _git2_config_entry_object {
2929
GIT2_CONFIG_ENTRY_GET_STRING(name)
3030
GIT2_CONFIG_ENTRY_GET_STRING(value)
3131

32-
void git2_config_entry_spawn(zval **return_value, git_config_entry *e TSRMLS_DC) {
32+
void git2_config_entry_spawn(zval *return_value, git_config_entry *e TSRMLS_DC) {
3333
git2_config_entry_object_t *intern;
3434

35-
object_init_ex(*return_value, php_git2_config_entry_ce);
36-
intern = (git2_config_entry_object_t*)Z_OBJ_P(*return_value);
35+
object_init_ex(return_value, php_git2_config_entry_ce);
36+
intern = (git2_config_entry_object_t*)Z_OBJ_P(return_value);
3737
intern->e = e;
3838
}
3939

git2_config_entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
void git2_config_entry_init(TSRMLS_DC);
55

6-
void git2_config_entry_spawn(zval **return_value, git_config_entry *e TSRMLS_DC);
6+
void git2_config_entry_spawn(zval *return_value, git_config_entry *e TSRMLS_DC);
77

88
#endif /* GIT2_CONFIG_ENTRY_H */

git2_reference.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "git2_exception.h"
33
#include "git2_reference.h"
44
#include "git2_commit.h"
5+
#include "git2_tree.h"
6+
#include "git2_blob.h"
57

68
static zend_class_entry *php_git2_reference_ce;
79
static zend_object_handlers php_git2_reference_handler;
@@ -68,7 +70,7 @@ static PHP_METHOD(Reference, resolve) {
6870
RETURN_FALSE;
6971
}
7072

71-
git2_reference_spawn(&return_value, out TSRMLS_CC);
73+
git2_reference_spawn(return_value, out TSRMLS_CC);
7274
}
7375

7476
ZEND_BEGIN_ARG_INFO_EX(arginfo_reference_peel, 0, 0, 1)
@@ -102,19 +104,25 @@ static PHP_METHOD(Reference, peel) {
102104
// TODO find object type, instanciate
103105
switch(git_object_type(out)) {
104106
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);
106114
return;
107115
default:
108116
git2_throw_exception(0 TSRMLS_CC, "Type of object is not implemented");
109117
return;
110118
}
111119
}
112120

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) {
114122
git2_reference_object_t *intern;
115123

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);
118126
intern->ref = ref;
119127
}
120128

git2_reference.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
void git2_reference_init(TSRMLS_DC);
55

6-
void git2_reference_spawn(zval **return_value, git_reference *ref TSRMLS_DC);
6+
void git2_reference_spawn(zval *return_value, git_reference *ref TSRMLS_DC);
77

88
#endif /* GIT2_REFERENCE_H */

0 commit comments

Comments
 (0)