CVS update: php3/functions
| From: | ssb | Date: | Mon, 22 Mar 1999 23:41:07 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4726@lists.php.net to get a copy of this message | ||
Date: Monday March 22, 1999 @ 18:41
Author: ssb
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv13939
Modified Files:
fsock.c
Log Message:
using memchr() in _php3_sock_fgets()
Index: php3/functions/fsock.c
diff -c php3/functions/fsock.c:1.87 php3/functions/fsock.c:1.88
*** php3/functions/fsock.c:1.87 Mon Mar 22 16:52:47 1999
--- php3/functions/fsock.c Mon Mar 22 18:41:07 1999
***************
*** 27,33 ****
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.c,v 1.87 1999/03/22 21:52:47 ssb Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 27,33 ----
| Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
! /* $Id: fsock.c,v 1.88 1999/03/22 23:41:07 ssb Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 282,287 ****
--- 282,288 ----
int _php3_sock_fgets(char *buf, int maxlen, int socket)
{
int retval, count = 0, toread, i;
+ char *ptr;
while (count < maxlen) {
toread = maxlen - count;
***************
*** 289,303 ****
if (retval <= 0) {
break;
}
! for (i = 0; i < retval; i++) {
! if (buf[i] == '\n') {
! if (i + count < maxlen) {
! i++;
! }
! count += i;
! buf += i;
! goto sock_fgets_exit;
}
}
count += retval;
buf += retval;
--- 290,303 ----
if (retval <= 0) {
break;
}
! ptr = (char *)memchr(buf, '\n', retval);
! if (ptr != NULL) {
! i = ptr - buf;
! if (count + i < maxlen) {
! i++;
}
+ count += i;
+ buf += i;
}
count += retval;
buf += retval;
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net