Skip to content

Commit 82108e6

Browse files
committed
Bump up to 0.2.1
- Support Thread safe environment. just fix missunderstanding code and check unittest. There may be other potential problems.
1 parent d944d80 commit 82108e6

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

src/backend.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static void php_git_backend_free_storage(php_git_backend_t *obj TSRMLS_DC)
5757

5858
int php_git_backend__exists(git_odb_backend *_backend, const git_oid *oid)
5959
{
60+
TSRMLS_FETCH();
6061
php_git_backend_internal *object = (php_git_backend_internal *)_backend;
6162
char out[GIT_OID_HEXSZ+1] = {0};
6263
git_oid_to_string(out,GIT_OID_HEXSZ+1,oid);
@@ -90,6 +91,7 @@ int php_git_backend__exists(git_odb_backend *_backend, const git_oid *oid)
9091
}
9192
int php_git_backend__write(git_oid *id, git_odb_backend *_backend, git_rawobj *obj)
9293
{
94+
TSRMLS_FETCH();
9395
php_git_backend_internal *object = (php_git_backend_internal *)_backend;
9496
int ret = 0;
9597
zval *retval;
@@ -104,8 +106,8 @@ int php_git_backend__write(git_oid *id, git_odb_backend *_backend, git_rawobj *o
104106
object_init_ex(params[0],git_rawobject_class_entry);
105107

106108
add_property_stringl_ex(params[0],"data",sizeof("data"),obj->data,obj->len,1 TSRMLS_CC);
107-
add_property_long(params[0],"type",obj->type TSRMLS_CC);
108-
add_property_long(params[0],"len",obj->len TSRMLS_CC);
109+
add_property_long(params[0],"type",obj->type);
110+
add_property_long(params[0],"len",obj->len);
109111

110112
php_git_rawobject_t *raw = (php_git_rawobject_t *) zend_object_store_get_object(params[0] TSRMLS_CC);
111113
raw->object = obj;
@@ -131,6 +133,7 @@ int php_git_backend__write(git_oid *id, git_odb_backend *_backend, git_rawobj *o
131133
}
132134
int php_git_backend__read(git_rawobj *obj, git_odb_backend *_backend, const git_oid *oid)
133135
{
136+
TSRMLS_FETCH();
134137
php_git_backend_internal *object = (php_git_backend_internal *)_backend;
135138
char out[GIT_OID_HEXSZ+1] = {0};
136139
git_oid_to_string(out,GIT_OID_HEXSZ+1,oid);
@@ -174,6 +177,7 @@ int php_git_backend__read(git_rawobj *obj, git_odb_backend *_backend, const git_
174177
}
175178
int php_git_backend__read_header(git_rawobj *obj, git_odb_backend *_backend, const git_oid *oid)
176179
{
180+
TSRMLS_FETCH();
177181
char out[GIT_OID_HEXSZ+1] = {0} ;
178182
php_git_backend_internal *object = (php_git_backend_internal *)_backend;
179183
git_oid_to_string(out,GIT_OID_HEXSZ+1,oid);
@@ -216,6 +220,7 @@ int php_git_backend__read_header(git_rawobj *obj, git_odb_backend *_backend, con
216220

217221
void php_git_backend__free(git_odb_backend *backend)
218222
{
223+
TSRMLS_FETCH();
219224
php_git_backend_internal *object = (php_git_backend_internal *)backend;
220225

221226
zval *retval;

src/commit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ PHP_METHOD(git_commit, setCommitter)
136136
c_obj = (php_git_commit_t *) zend_object_store_get_object(this TSRMLS_CC);
137137
s_obj = (php_git_signature_t *) zend_object_store_get_object(z_signature TSRMLS_CC);
138138
git_commit_set_author(c_obj->object, s_obj->signature);
139-
add_property_zval_ex(object,"committer",10,z_signature);
139+
add_property_zval_ex(object,"committer",10,z_signature TSRMLS_CC);
140140
}
141141

142142
PHP_METHOD(git_commit, getCommitter)
@@ -194,7 +194,7 @@ PHP_METHOD(git_commit, setAuthor)
194194
c_obj = (php_git_commit_t *) zend_object_store_get_object(this TSRMLS_CC);
195195
s_obj = (php_git_signature_t *) zend_object_store_get_object(z_signature TSRMLS_CC);
196196
git_commit_set_committer(c_obj->object, s_obj->signature);
197-
add_property_zval_ex(object,"author",sizeof("author"),z_signature);
197+
add_property_zval_ex(object,"author",sizeof("author"),z_signature TSRMLS_CC);
198198
}
199199

200200
PHP_METHOD(git_commit, setTree)
@@ -287,7 +287,7 @@ PHP_METHOD(git_commit, getMessage)
287287
const char *message;
288288

289289
message = git_commit_message(this->object);
290-
RETURN_STRING(message,1 TSRMLS_C);
290+
RETURN_STRING(message,1);
291291
}
292292

293293
PHP_METHOD(git_commit, getShortMessage)
@@ -296,7 +296,7 @@ PHP_METHOD(git_commit, getShortMessage)
296296
const char *message;
297297

298298
message = git_commit_message_short(this->object);
299-
RETURN_STRING(message,1 TSRMLS_C);
299+
RETURN_STRING(message,1);
300300
}
301301

302302
PHP_METHOD(git_commit, getTree)

src/index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ ZEND_END_ARG_INFO()
9191

9292
void php_git_index_entry_create(zval **index, git_index_entry *entry)
9393
{
94+
TSRMLS_FETCH();
9495
MAKE_STD_ZVAL(*index);
9596
char oid[GIT_OID_HEXSZ+1] = {0};
9697
object_init_ex(*index,git_index_entry_class_entry);

src/odb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ PHP_METHOD(git_odb, __construct)
8181

8282
int php_git_odb_add_alternate(git_odb **odb, zval *backend, int priority)
8383
{
84+
TSRMLS_FETCH();
8485
int ret = GIT_SUCCESS;
8586
php_git_backend_t *b;
8687
if(!instanceof_function(Z_OBJCE_P(backend), git_backend_class_entry TSRMLS_CC)){
@@ -102,6 +103,7 @@ int php_git_odb_add_alternate(git_odb **odb, zval *backend, int priority)
102103

103104
int php_git_odb_add_backend(git_odb **odb, zval *backend, int priority)
104105
{
106+
TSRMLS_FETCH();
105107
int ret = GIT_SUCCESS;
106108
php_git_backend_t *b;
107109
if(!instanceof_function(Z_OBJCE_P(backend), git_backend_class_entry TSRMLS_CC)){

src/repository.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ PHP_METHOD(git_repository, getObject)
238238

239239
void create_tree_entry_from_entry(zval **object, git_tree_entry *entry)
240240
{
241+
TSRMLS_FETCH();
241242
char buf[41] = {0};
242243
const git_oid *oid;
243244
MAKE_STD_ZVAL(*object);

src/signature.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ void git_init_signature(TSRMLS_D)
9393

9494
void create_signature_from_commit(zval **signature, git_signature *sig)
9595
{
96+
TSRMLS_FETCH();
9697
zval *datetime;
9798
MAKE_STD_ZVAL(*signature);
9899

@@ -157,6 +158,7 @@ zend_object_value php_git_signature_new(zend_class_entry *ce TSRMLS_DC)
157158

158159
int php_git_signature_create(zval *object, char *name, int name_len, char *email, int email_len, zval *time)
159160
{
161+
TSRMLS_FETCH();
160162
php_git_signature_t *this = (php_git_signature_t *) zend_object_store_get_object(object TSRMLS_CC);
161163
int ret = 0;
162164
// Todo: should use `zend_fcall*` instead of `call_user-function` for performance improvement.
@@ -178,7 +180,7 @@ int php_git_signature_create(zval *object, char *name, int name_len, char *email
178180

179181
add_property_string_ex(object,"name", sizeof("name"), name, 1 TSRMLS_CC);
180182
add_property_string_ex(object,"email",sizeof("email"), email, 1 TSRMLS_CC);
181-
add_property_zval_ex(object,"time",sizeof("time"),time);
183+
add_property_zval_ex(object,"time",sizeof("time"),time TSRMLS_CC);
182184

183185
zval_ptr_dtor(&retval);
184186
zval_dtor(&func);

src/tree_entry.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ PHP_METHOD(git_tree_entry, setId)
7979
char out[GIT_OID_HEXSZ+1] = {0};
8080
git_oid_to_string(out,GIT_OID_HEXSZ+1,git_tree_entry_id(this->entry));
8181

82-
add_property_string(getThis(), "oid", hash, 1 TSRMLS_C);
82+
add_property_string(getThis(), "oid", hash, 1);
8383

8484
RETVAL_STRING(hash, 1);
8585
}

0 commit comments

Comments
 (0)