commit 63b5fd974c549214369e9a6db8d9a0e6fb2c54b0
parent 3ae47e6bb4312bc0f91a173026d48e25cf51df44
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 11 Jun 2010 22:56:15 +0000
reduce strstr calls by one
Diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -466,8 +466,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
FD_SET (fd, read_fd_set);
/* update max file descriptor */
- if ( (NULL != max_fd) &&
- ((*max_fd) < fd) )
+ if ((*max_fd) < fd)
*max_fd = fd;
con_itr = daemon->connections;
diff --git a/src/daemon/postprocessor.c b/src/daemon/postprocessor.c
@@ -273,10 +273,10 @@ MHD_create_post_processor (struct MHD_Connection *connection,
boundary =
&encoding[strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)];
/* Q: should this be "strcasestr"? */
- if (NULL != strstr (boundary, "boundary="))
- boundary = strstr (boundary, "boundary=") + strlen ("boundary=");
- else
- return NULL; /* failed to determine boundary */
+ boundary = strstr (boundary, "boundary=");
+ if (NULL == boundary)
+ return NULL; /* failed to determine boundary */
+ boundary += strlen ("boundary=");
blen = strlen (boundary);
if ((blen == 0) || (blen * 2 + 2 > buffer_size))
return NULL; /* (will be) out of memory or invalid boundary */