RE: [PHP-CVS] com php-src: Shave off a strlen() call in ftp_mkdir(): ext/ftp/ftp.c ext/ftp/ftp.h ext/ftp/php_ftp.c

From: Date: Mon, 21 Nov 2016 23:17:58 +0000
Subject: RE: [PHP-CVS] com php-src: Shave off a strlen() call in ftp_mkdir(): ext/ftp/ftp.c ext/ftp/ftp.h ext/ftp/php_ftp.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95948@lists.php.net to get a copy of this message
Hi Kalle, > -----Original Message----- > From: Kalle Sommer Nielsen [mailto:kalle@php.net] > Sent: Sunday, November 20, 2016 7:37 PM > To: php-cvs@lists.php.net > Subject: [PHP-CVS] com php-src: Shave off a strlen() call in ftp_mkdir(): > ext/ftp/ftp.c ext/ftp/ftp.h ext/ftp/php_ftp.c > > Commit: 06767ffcbe097151b07a26d8d4beb4a102ac853a > Author: Kalle Sommer Nielsen <kalle@php.net> Sun, 20 Nov 2016 19:36:36 > +0100 > Parents: d7deaac362e86d2a5f1da8677d4dab4ae35abefc > Branches: master > > Link: http://git.php.net/?p=php- > src.git;a=commitdiff;h=06767ffcbe097151b07a26d8d4beb4a102ac853a > > Log: > Shave off a strlen() call in ftp_mkdir() > > Changed paths: > M ext/ftp/ftp.c > M ext/ftp/ftp.h > M ext/ftp/php_ftp.c > Seems Travis still doesn't like the latest changes to ext/ftp. Could you please check that? Thanks Anatol > > Diff: > diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c > index dfefdd4..0e0bfd6 100644 > --- a/ext/ftp/ftp.c > +++ b/ext/ftp/ftp.c > @@ -560,7 +560,7 @@ ftp_cdup(ftpbuf_t *ftp) > /* {{{ ftp_mkdir > */ > zend_string* > -ftp_mkdir(ftpbuf_t *ftp, const char *dir) > +ftp_mkdir(ftpbuf_t *ftp, const char *dir, const size_t dir_len) > { > char *mkd, *end; > zend_string *ret; > @@ -576,7 +576,7 @@ ftp_mkdir(ftpbuf_t *ftp, const char *dir) > } > /* copy out the dir from response */ > if ((mkd = strchr(ftp->inbuf, '"')) == NULL) { > - return zend_string_init(dir, strlen(dir), 0); > + return zend_string_init(dir, dir_len, 0); > } > if ((end = strrchr(++mkd, '"')) == NULL) { > return NULL; > diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h > index 881890e..d355242 100644 > --- a/ext/ftp/ftp.h > +++ b/ext/ftp/ftp.h > @@ -135,7 +135,7 @@ int ftp_cdup(ftpbuf_t *ftp); > /* creates a directory, return the directory name on success, NULL on error. > * the return value must be freed > */ > -zend_string* ftp_mkdir(ftpbuf_t *ftp, const char *dir); > +zend_string* ftp_mkdir(ftpbuf_t *ftp, const char *dir, const size_t dir_len); > > /* removes a directory, return true on success, false on error */ > int ftp_rmdir(ftpbuf_t *ftp, const char *dir); > diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c > index f9d397f..6686690 100644 > --- a/ext/ftp/php_ftp.c > +++ b/ext/ftp/php_ftp.c > @@ -593,7 +593,7 @@ PHP_FUNCTION(ftp_mkdir) > } > > /* create directorie */ > - if (NULL == (tmp = ftp_mkdir(ftp, dir))) { > + if (NULL == (tmp = ftp_mkdir(ftp, dir, dir_len))) { > php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf); > RETURN_FALSE; > } > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.cvs (#95948) next »