diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-05-06 14:50:54 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-05-06 14:50:54 +0400 |
commit | 6f5a0df570b3046523dd4ab9d5054be7f44df1f6 (patch) | |
tree | 26c082b96ee4d37a6920f8173ce732a031dda31d /ext/posix | |
parent | 53b5de1e6419e67660ed8733fb598504f5c55ba9 (diff) | |
download | php-git-6f5a0df570b3046523dd4ab9d5054be7f44df1f6.tar.gz |
added support for ext/posix
Diffstat (limited to 'ext/posix')
-rw-r--r-- | ext/posix/posix.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 64ef62742e..bf7c28c50d 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -531,7 +531,7 @@ PHP_FUNCTION(posix_getlogin) RETURN_FALSE; } - RETURN_STRING(p, 1); + RETURN_STRING(p); } #endif /* }}} */ @@ -687,7 +687,7 @@ PHP_FUNCTION(posix_ctermid) RETURN_FALSE; } - RETURN_STRING(buffer, 1); + RETURN_STRING(buffer); } #endif /* }}} */ @@ -697,7 +697,7 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd TSRMLS_DC) /* {{{ */ { php_stream *stream; - php_stream_from_zval_no_verify(stream, &zfp); + php_stream_from_zval_no_verify(stream, zfp); if (stream == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 1 to be a valid stream resource"); @@ -720,26 +720,26 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd TSRMLS_DC) /* {{{ */ Determine terminal device name (POSIX.1, 4.7.2) */ PHP_FUNCTION(posix_ttyname) { - zval **z_fd; + zval *z_fd; char *p; int fd; #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) long buflen; #endif - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &z_fd) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) { RETURN_FALSE; } - switch (Z_TYPE_PP(z_fd)) { + switch (Z_TYPE_P(z_fd)) { case IS_RESOURCE: - if (!php_posix_stream_get_fd(*z_fd, &fd TSRMLS_CC)) { + if (!php_posix_stream_get_fd(z_fd, &fd TSRMLS_CC)) { RETURN_FALSE; } break; default: convert_to_long_ex(z_fd); - fd = Z_LVAL_PP(z_fd); + fd = Z_LVAL_P(z_fd); } #if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) buflen = sysconf(_SC_TTY_NAME_MAX); @@ -760,7 +760,7 @@ PHP_FUNCTION(posix_ttyname) RETURN_FALSE; } #endif - RETURN_STRING(p, 1); + RETURN_STRING(p); } /* }}} */ @@ -768,22 +768,22 @@ PHP_FUNCTION(posix_ttyname) Determine if filedesc is a tty (POSIX.1, 4.7.1) */ PHP_FUNCTION(posix_isatty) { - zval **z_fd; + zval *z_fd; int fd; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &z_fd) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_fd) == FAILURE) { RETURN_FALSE; } - switch (Z_TYPE_PP(z_fd)) { + switch (Z_TYPE_P(z_fd)) { case IS_RESOURCE: - if (!php_posix_stream_get_fd(*z_fd, &fd TSRMLS_CC)) { + if (!php_posix_stream_get_fd(z_fd, &fd TSRMLS_CC)) { RETURN_FALSE; } break; default: convert_to_long_ex(z_fd); - fd = Z_LVAL_PP(z_fd); + fd = Z_LVAL_P(z_fd); } if (isatty(fd)) { @@ -818,7 +818,7 @@ PHP_FUNCTION(posix_getcwd) RETURN_FALSE; } - RETURN_STRING(buffer, 1); + RETURN_STRING(buffer); } /* }}} */ @@ -913,7 +913,7 @@ PHP_FUNCTION(posix_mknod) * array container and fills the array with the posix group member data. */ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ { - zval *array_members; + zval array_members; int count; if (NULL == g) @@ -922,15 +922,14 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ if (array_group == NULL || Z_TYPE_P(array_group) != IS_ARRAY) return 0; - MAKE_STD_ZVAL(array_members); - array_init(array_members); + array_init(&array_members); add_assoc_string(array_group, "name", g->gr_name); add_assoc_string(array_group, "passwd", g->gr_passwd); for (count=0; g->gr_mem[count] != NULL; count++) { - add_next_index_string(array_members, g->gr_mem[count]); + add_next_index_string(&array_members, g->gr_mem[count]); } - zend_hash_update(Z_ARRVAL_P(array_group), "members", sizeof("members"), (void*)&array_members, sizeof(zval*), NULL); + 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; } @@ -1342,7 +1341,7 @@ PHP_FUNCTION(posix_strerror) RETURN_FALSE; } - RETURN_STRING(strerror(error), 1); + RETURN_STRING(strerror(error)); } /* }}} */ |