Skip to content

Commit e76da6c

Browse files
committed
Git\\Revwalk. fix tab to space & use GIT_OID_HEXSZ+1.
1 parent c43532b commit e76da6c

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/walker.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ static void php_git_walker_free_storage(php_git_walker_t *obj TSRMLS_DC)
5454

5555
zend_object_value php_git_walker_new(zend_class_entry *ce TSRMLS_DC)
5656
{
57-
zend_object_value retval;
58-
php_git_walker_t *obj;
59-
zval *tmp;
57+
zend_object_value retval;
58+
php_git_walker_t *obj;
59+
zval *tmp;
6060

61-
obj = ecalloc(1, sizeof(*obj));
62-
zend_object_std_init( &obj->zo, ce TSRMLS_CC );
63-
zend_hash_copy(obj->zo.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
61+
obj = ecalloc(1, sizeof(*obj));
62+
zend_object_std_init( &obj->zo, ce TSRMLS_CC );
63+
zend_hash_copy(obj->zo.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
6464

65-
retval.handle = zend_objects_store_put(obj,
65+
retval.handle = zend_objects_store_put(obj,
6666
(zend_objects_store_dtor_t)zend_objects_destroy_object,
6767
(zend_objects_free_object_storage_t)php_git_walker_free_storage,
6868
NULL TSRMLS_CC);
69-
retval.handlers = zend_get_std_object_handlers();
70-
return retval;
69+
retval.handlers = zend_get_std_object_handlers();
70+
return retval;
7171
}
7272

7373
PHP_METHOD(git_walker, __construct)
@@ -128,7 +128,7 @@ PHP_METHOD(git_walker, next)
128128
zval *git_commit_object;
129129
char *hash;
130130
int hash_len = 0;
131-
char oid[GIT_OID_HEXSZ];
131+
char oid[GIT_OID_HEXSZ+1];
132132
git_commit *commit;
133133
git_revwalk *walker;
134134
git_signature *signature;
@@ -159,10 +159,7 @@ PHP_METHOD(git_walker, next)
159159
add_property_zval(git_commit_object,"author", author);
160160
add_property_zval(git_commit_object,"committer", committer);
161161

162-
RETURN_ZVAL(git_commit_object,1,0);
163-
efree(git_commit_object);
164-
efree(author);
165-
efree(committer);
162+
RETURN_ZVAL(git_commit_object,0,0);
166163
}
167164

168165

@@ -202,5 +199,5 @@ void git_init_walker(TSRMLS_D)
202199
zend_class_entry git_walker_ce;
203200
INIT_NS_CLASS_ENTRY(git_walker_ce, PHP_GIT_NS,"Revwalk", php_git_walker_methods);
204201
git_walker_class_entry = zend_register_internal_class(&git_walker_ce TSRMLS_CC);
205-
git_walker_class_entry->create_object = php_git_walker_new;
202+
git_walker_class_entry->create_object = php_git_walker_new;
206203
}

0 commit comments

Comments
 (0)