httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/server util.c
Date Sun, 02 Dec 2001 05:46:36 GMT
brianp      01/12/01 21:46:36

  Modified:    server   util.c
  Log:
  Reduced the number of strlen operations in ap_getword()
  
  Revision  Changes    Path
  1.116     +12 -9     httpd-2.0/server/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util.c,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- util.c	2001/12/02 05:09:51	1.115
  +++ util.c	2001/12/02 05:46:36	1.116
  @@ -642,21 +642,24 @@
   
   AP_DECLARE(char *) ap_getword(apr_pool_t *atrans, const char **line, char stop)
   {
  -    const char *pos = ap_strchr_c(*line, stop);
  +    const char *pos = *line;
  +    int len;
       char *res;
   
  -    if (!pos) {
  -	res = apr_pstrdup(atrans, *line);
  -	*line += strlen(*line);
  -	return res;
  +    while ((*pos != stop) && *pos) {
  +        ++pos;
       }
   
  -    res = apr_pstrndup(atrans, *line, pos - *line);
  +    len = pos - *line;
  +    res = (char *)apr_palloc(atrans, len + 1);
  +    memcpy(res, *line, len);
  +    res[len] = 0;
   
  -    while (*pos == stop) {
  -	++pos;
  +    if (stop) {
  +        while (*pos == stop) {
  +            ++pos;
  +        }
       }
  -
       *line = pos;
   
       return res;
  
  
  

Mime
View raw message