httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] Re: ap_snprintf()
Date Sun, 19 Jan 1997 23:18:13 GMT
On Sun, 19 Jan 1997, Alexei Kosut wrote:
> +1. Though it would be nice if you could give us context diffs.

D'ohh, what was I thinking.

Dean

Index: util_snprintf.c
===================================================================
RCS file: /export/home/cvs/apache/src/util_snprintf.c,v
retrieving revision 1.2
diff -c -3 -r1.2 util_snprintf.c
*** util_snprintf.c	1997/01/18 21:28:15	1.2
--- util_snprintf.c	1997/01/19 23:17:29
***************
*** 63,68 ****
--- 63,71 ----
  #include <ctype.h>
  #include <sys/types.h>
  #include <stdarg.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <math.h>
  
  #ifdef HAVE_CVT
  
***************
*** 77,85 ****
   * from GNU libc-4.6.27
   */
  
- #include <stdlib.h>
- #include <math.h>
- 
  /*
   *    ap_ecvt converts to decimal
   *      the number of digits is specified by ndigit
--- 80,85 ----
***************
*** 273,284 ****
  /*
   * Descriptor for buffer area
   */
! struct __buf_area {
      char *buf_end;
      char *nextb;		/* pointer to next byte to read/write   */
  };
  
! typedef struct __buf_area __buffy;
  
  /*
   * The INS_CHAR macro inserts a character in the buffer and writes
--- 273,284 ----
  /*
   * Descriptor for buffer area
   */
! struct buf_area {
      char *buf_end;
      char *nextb;		/* pointer to next byte to read/write   */
  };
  
! typedef struct buf_area buffy;
  
  /*
   * The INS_CHAR macro inserts a character in the buffer and writes
***************
*** 416,423 ****
      register char *s = buf;
      register char *p;
      int decimal_point;
-     extern char *ap_ecvt(), *ap_fcvt();
-     char *strcpy(char *, const char *);
  
      if (format == 'f')
  	p = ap_fcvt(num, precision, &decimal_point, is_negative);
--- 416,421 ----
***************
*** 528,534 ****
  /*
   * Do format conversion placing the output in buffer
   */
! static int __format_converter(register __buffy * odp, const char *fmt,
  			      va_list ap)
  {
      register char *sp;
--- 526,532 ----
  /*
   * Do format conversion placing the output in buffer
   */
! static int format_converter(register buffy * odp, const char *fmt,
  			      va_list ap)
  {
      register char *sp;
***************
*** 566,576 ****
      boolean_e adjust_width;
      bool_int is_negative;
  
-     extern char *ap_gcvt();
-     char *strchr(const char *, int);
-     int isascii(int);
- 
- 
      sp = odp->nextb;
      bep = odp->buf_end;
  
--- 564,569 ----
***************
*** 847,853 ****
  		 * We print %<char> to help the user identify what
  		 * option is not understood.
  		 * This is also useful in case the user wants to pass
! 		 * the output of __format_converter to another function
  		 * that understands some other %<char> (like syslog).
  		 * Note that we can't point s inside fmt because the
  		 * unknown <char> could be preceded by width etc.
--- 840,846 ----
  		 * We print %<char> to help the user identify what
  		 * option is not understood.
  		 * This is also useful in case the user wants to pass
! 		 * the output of format_converter to another function
  		 * that understands some other %<char> (like syslog).
  		 * Note that we can't point s inside fmt because the
  		 * unknown <char> could be preceded by width etc.
***************
*** 900,906 ****
  static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
  			va_list ap)
  {
!     __buffy od;
      int cc;
  
      /*
--- 893,899 ----
  static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
  			va_list ap)
  {
!     buffy od;
      int cc;
  
      /*
***************
*** 914,920 ****
      /*
       * Do the conversion
       */
!     cc = __format_converter(&od, format, ap);
      if (len == 0 || od.nextb <= od.buf_end)
  	*(od.nextb) = '\0';
      if (ccp)
--- 907,913 ----
      /*
       * Do the conversion
       */
!     cc = format_converter(&od, format, ap);
      if (len == 0 || od.nextb <= od.buf_end)
  	*(od.nextb) = '\0';
      if (ccp)



Mime
View raw message