httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCHES] various portability things...
Date Tue, 02 Sep 1997 06:12:11 GMT


On Wed, 27 Aug 1997, Martin Kraemer wrote:

> Here's a list of unrelated patches which you might want to comment
> on... (Or is my compiler just too picky? Only by applying these
> patches could I make it most of apache's modules _without_ warnings)
> 
>     Martin
> 
> **** In SVR4, many machines have B_ERROR defined. This gives me lots
> **** of warnings when it gets redefined:
> 
> Index: main/buff.h
> ===================================================================
> RCS file: /home/cvs/apachen/src/main/buff.h,v
> retrieving revision 1.3.0.1
> diff -u -r1.3.0.1 buff.h
> --- buff.h	1997/08/21 14:35:55	1.3.0.1
> +++ buff.h	1997/08/27 09:28:38
> @@ -69,6 +69,9 @@
>  #define B_RDERR (16)
>  /* A write error has occurred */
>  #define B_WRERR (32)
> +#ifdef B_ERROR  /* in SVR4: sometimes defined in /usr/include/sys/buf.h */
> +#undef B_ERROR
> +#endif
>  #define B_ERROR (48)
>  /* Use chunked writing */
>  #define B_CHUNK (64)

I'd actually favour renaming all of these to BUFF_* ... but the above
is fine with me as an interim.

> **** On my SVR4 platform (and I assume on many others as well),
> **** the size argument is size_t, not the (apache default of) int:
> Index: main/conf.h
> ===================================================================
> RCS file: /home/cvs/apachen/src/main/conf.h,v
> retrieving revision 1.5
> diff -u -r1.5 conf.h
> --- conf.h	1997/08/25 12:13:19	1.5
> +++ conf.h	1997/08/27 09:28:38
> @@ -368,6 +368,9 @@
>  #define JMP_BUF sigjmp_buf
>  /* A lot of SVR4 systems need this */
>  #define USE_FCNTL_SERIALIZED_ACCEPT
> +#ifdef SNI  /* SINIX/ReliantUNIX, probably other SVR4's as well */
> +#define NET_SIZE_T size_t
> +#endif /*SNI*/
>  
>  #elif defined(UW)
>  #define NO_LINGCLOSE

+1 on #define NET_SIZE_T size_t for all svr4s. 

I've learned a little more about this particular issue.  POSIX.something
dictated that the network functions (like accept) that pass back a length
through a pointer would use size_t for that length.  Sane people pointed
out that size_t is usually 64 bits on a 64-bit box, and int is only
32-bit, so this new POSIX requirement would break any program written in
the BSD-style (where the length is an int).  Subsequently a type socklen_t
was created, and it is used for the length pointers ... so we might want
to change the define from NET_SIZE_T to SOCKLEN_T. 

> 
> **** another attempt to resolve the size_t vs. int conflict:
> **** (BTW: what about the portability of the in_addr_t type?
> **** In the proxy module, test for (inet_addr() == -1) give me
> **** some warnings, too.)
> Index: main/util_script.c
> ===================================================================
> RCS file: /home/cvs/apachen/src/main/util_script.c,v
> retrieving revision 1.3.0.1
> diff -u -r1.3.0.1 util_script.c
> --- util_script.c	1997/08/21 14:36:01	1.3.0.1
> +++ util_script.c	1997/08/27 09:28:39
> @@ -439,7 +439,7 @@
>  API_EXPORT(void) send_size(size_t size, request_rec *r) {
>      char ss[20];
>  
> -    if(size == -1) 
> +    if(size == (size_t)-1)
>          strcpy(ss, "    -");
>      else if(!size) 
>          strcpy(ss, "   0k");

I doubt that in_addr_t is portable.

I can't tell where send_size is called with a negative size.  It doesn't
ever seem to be ... 

> 
> **** Another unused variable which could be eliminated:
> Index: modules/proxy/proxy_util.c
> ===================================================================
> RCS file: /home/cvs/apachen/src/modules/proxy/proxy_util.c,v
> retrieving revision 1.4
> diff -u -r1.4 proxy_util.c
> --- proxy_util.c	1997/08/25 08:26:50	1.4
> +++ proxy_util.c	1997/08/27 09:28:40
> @@ -110,7 +110,7 @@
>  char *
>  proxy_canonenc(pool *p, const char *x, int len, enum enctype t, int isenc)
>  {
> -    int i, j, ispath, ch;
> +    int i, j, ch;
>      char *y;
>      const char *allowed;  /* characters which should not be encoded */
>      const char *reserved;  /* characters which much not be en/de-coded */
> @@ -133,7 +133,6 @@
>      else reserved = "";
>  
>      y = palloc(p, 3*len+1);
> -    ispath = (t == enc_path);
>  
>      for (i=0, j=0; i < len; i++, j++)
>      {
> 

+1

Dean


Mime
View raw message