Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions ext/posix/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,16 +659,12 @@ PHP_FUNCTION(posix_mknod)

/* Takes a pointer to posix group and a pointer to an already initialized ZVAL
* array container and fills the array with the posix group member data. */
int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
static void php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
{
zval array_members;
int count;

if (NULL == g)
return 0;

if (array_group == NULL || Z_TYPE_P(array_group) != IS_ARRAY)
return 0;
ZEND_ASSERT(Z_TYPE_P(array_group) == IS_ARRAY);

array_init(&array_members);
zend_hash_real_init_packed(Z_ARRVAL(array_members));
Expand All @@ -691,7 +687,6 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */
}
zend_hash_str_update(Z_ARRVAL_P(array_group), "members", sizeof("members")-1, &array_members);
add_assoc_long(array_group, "gid", g->gr_gid);
return 1;
}
/* }}} */

Expand Down Expand Up @@ -833,11 +828,7 @@ PHP_FUNCTION(posix_getgrnam)
#endif
array_init(return_value);

if (!php_posix_group_to_array(g, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "Unable to convert posix group to array");
RETVAL_FALSE;
}
php_posix_group_to_array(g, return_value);
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
efree(buf);
#endif
Expand Down Expand Up @@ -895,11 +886,7 @@ PHP_FUNCTION(posix_getgrgid)
#endif
array_init(return_value);

if (!php_posix_group_to_array(g, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "Unable to convert posix group struct to array");
RETVAL_FALSE;
}
php_posix_group_to_array(g, return_value);
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
efree(grbuf);
#endif
Expand Down