diff options
author | Andi Gutmans <andi@php.net> | 2000-04-30 16:32:36 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-04-30 16:32:36 +0000 |
commit | e13285ded79f94c9349763f59014eb467357cefc (patch) | |
tree | d777a222d182ac6f6fbace611e27d7cddf06f478 /ext/standard/file.c | |
parent | 8e7a5098dd31cc768c34c046820822dfeb9d048d (diff) | |
download | php-git-e13285ded79f94c9349763f59014eb467357cefc.tar.gz |
- Take Sascha's advice and create on V_OPEN() which replaces open().
- Unlike the other macros its argument has to have braces around it, for
- example, open(filename, flags) becomse V_OPEN((filename, flags))
- Made small conversion to new Zend macros. The ugly (*foo)->value.str.val
- now becomes Z_STRVAL_PP(foo). PP means pointer pointer, there also exist
- single P's for example foo->value.str.val becomes Z_STRVAL_P(foo).
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r-- | ext/standard/file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 847b574c85..37bd5c233b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1559,26 +1559,26 @@ PHP_FUNCTION(copy) } #ifdef PHP_WIN32 - if ((fd_s=open((*source)->value.str.val,O_RDONLY|_O_BINARY))==-1) { + if ((fd_s=V_OPEN((Z_STRVAL_PP(source),O_RDONLY|_O_BINARY)))==-1) { #else - if ((fd_s=open((*source)->value.str.val,O_RDONLY))==-1) { + if ((fd_s=V_OPEN((Z_STRVAL_PP(source),O_RDONLY)))==-1) { #endif - php_error(E_WARNING,"Unable to open '%s' for reading: %s",(*source)->value.str.val,strerror(errno)); + php_error(E_WARNING,"Unable to open '%s' for reading: %s", Z_STRVAL_PP(source), strerror(errno)); RETURN_FALSE; } #ifdef PHP_WIN32 - if ((fd_t=open((*target)->value.str.val,_O_WRONLY|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE))==-1){ + if ((fd_t=V_OPEN((Z_STRVAL_PP(target),_O_WRONLY|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE)))==-1){ #else - if ((fd_t=creat((*target)->value.str.val,0777))==-1) { + if ((fd_t=V_CREAT(Z_STRVAL_PP(target),0777))==-1) { #endif - php_error(E_WARNING,"Unable to create '%s': %s", (*target)->value.str.val,strerror(errno)); + php_error(E_WARNING,"Unable to create '%s': %s", Z_STRVAL_PP(target), strerror(errno)); close(fd_s); RETURN_FALSE; } while ((read_bytes=read(fd_s,buffer,8192))!=-1 && read_bytes!=0) { if (write(fd_t,buffer,read_bytes)==-1) { - php_error(E_WARNING,"Unable to write to '%s': %s",(*target)->value.str.val,strerror(errno)); + php_error(E_WARNING,"Unable to write to '%s': %s", Z_STRVAL_PP(target), strerror(errno)); close(fd_s); close(fd_t); RETURN_FALSE; |