]> granicus.if.org Git - php/commitdiff
added support for ext/posix
authorDmitry Stogov <dmitry@zend.com>
Tue, 6 May 2014 10:50:54 +0000 (14:50 +0400)
committerDmitry Stogov <dmitry@zend.com>
Tue, 6 May 2014 10:50:54 +0000 (14:50 +0400)
ext/posix/posix.c

index 64ef62742e330425944f1d3242769bd64defb2ec..bf7c28c50dbea26bc4ca5f56b00d858cd3171556 100644 (file)
@@ -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));
 }
 /* }}} */