You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by do...@apache.org on 2002/05/23 05:25:21 UTC

cvs commit: apache-1.3/src/main util.c

dougm       02/05/22 20:25:20

  Modified:    src/main util.c
  Log:
  ap_escape_logitem referenced c2x() before it was declared, fatal error
  with hpux cc.  move c2x definition before ap_escape_logitem.
  
  Revision  Changes    Path
  1.205     +22 -23    apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.204
  retrieving revision 1.205
  diff -u -r1.204 -r1.205
  --- util.c	21 May 2002 13:03:56 -0000	1.204
  +++ util.c	23 May 2002 03:25:20 -0000	1.205
  @@ -1446,6 +1446,28 @@
       return (strncasecmp(&line[lidx], tok, tlen) == 0);
   }
   
  +/* c2x takes an unsigned, and expects the caller has guaranteed that
  + * 0 <= what < 256... which usually means that you have to cast to
  + * unsigned char first, because (unsigned)(char)(x) first goes through
  + * signed extension to an int before the unsigned cast.
  + *
  + * The reason for this assumption is to assist gcc code generation --
  + * the unsigned char -> unsigned extension is already done earlier in
  + * both uses of this code, so there's no need to waste time doing it
  + * again.
  + */
  +static const char c2x_table[] = "0123456789abcdef";
  +
  +static ap_inline unsigned char *c2x(unsigned what, unsigned char *where)
  +{
  +#ifdef CHARSET_EBCDIC
  +    what = os_toascii[what];
  +#endif /*CHARSET_EBCDIC*/
  +    *where++ = '%';
  +    *where++ = c2x_table[what >> 4];
  +    *where++ = c2x_table[what & 0xf];
  +    return where;
  +}
   
   /* escape a string for logging */
   API_EXPORT(char *) ap_escape_logitem(pool *p, const char *str)
  @@ -1601,29 +1623,6 @@
       else {
   	return ap_psprintf(p, "%s:%u", hostname, port);
       }
  -}
  -
  -/* c2x takes an unsigned, and expects the caller has guaranteed that
  - * 0 <= what < 256... which usually means that you have to cast to
  - * unsigned char first, because (unsigned)(char)(x) first goes through
  - * signed extension to an int before the unsigned cast.
  - *
  - * The reason for this assumption is to assist gcc code generation --
  - * the unsigned char -> unsigned extension is already done earlier in
  - * both uses of this code, so there's no need to waste time doing it
  - * again.
  - */
  -static const char c2x_table[] = "0123456789abcdef";
  -
  -static ap_inline unsigned char *c2x(unsigned what, unsigned char *where)
  -{
  -#ifdef CHARSET_EBCDIC
  -    what = os_toascii[what];
  -#endif /*CHARSET_EBCDIC*/
  -    *where++ = '%';
  -    *where++ = c2x_table[what >> 4];
  -    *where++ = c2x_table[what & 0xf];
  -    return where;
   }
   
   /*