httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: [PATCH] Two tiny casts
Date Sun, 28 Mar 1999 10:41:20 GMT

In article <Pine.SOL.3.91.990328045607.10504A@soc13.acpub.duke.edu> you wrote:

> Fix two little cast issues.  My compilers don't care too much, perhaps 
> some do though.
> 
> -- 
> John Bley - jbb6@acpub.duke.edu
> Duke '99 - English/Computer Science
>   Since English is a mess, it maps well onto the problem space,
>   which is also a mess, which we call reality.     - Larry Wall
> 
> diff -Burp apache-1.3/src/main/http_config.c apache-1.3-patched/src/main/http_config.c
> --- apache-1.3/src/main/http_config.c	Wed Mar 10 09:12:31 1999
> +++ apache-1.3-patched/src/main/http_config.c	Sun Mar 28 04:16:47 1999
> @@ -314,7 +314,7 @@ static void build_method_shortcuts(void)
>  
>      if (method_ptrs) {
>  	/* free up any previous set of method_ptrs */
> -	free(method_ptrs);
> +	free((void *)method_ptrs);
>      }
>  
>      /* first we count how many functions we have */
> @@ -326,7 +326,8 @@ static void build_method_shortcuts(void)
>  	    }
>  	}
>      }
> -    method_ptrs = malloc((how_many_ptrs + NMETHODS) * sizeof(handler_func));
> +    method_ptrs = (handler_func *) malloc((how_many_ptrs + NMETHODS) * 
> +	sizeof(handler_func));
>      if (method_ptrs == NULL) {
>  	fprintf(stderr, "Ouch!  Out of memory in build_method_shortcuts()!\n");
>      }

The cast for malloc()'s return value is usually ok, but why do you need the
cast for the argument to free()? free() is usually declared as ``void
free(void *ptr)'', so a cast for the argument shouldn't be necessary IMHO...

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Mime
View raw message