[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/atoms rmtobj.mx, , 1.4, 1.5

Sjoerd Mullender sjoerd at acm.org
Mon Aug 4 11:41:26 CEST 2008


Fabian wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/atoms
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22761
> 
> Modified Files:
> 	rmtobj.mx 
> Log Message:
> For what its worth, apply my diffs after merging Martin's changes.  I
> basically had the same fixes.
> 
> 

> @@ -86,11 +86,11 @@
>  int
>  RMTOtoString(str *retval, int *len, str handle)
>  {
> -	int hl = (int) strlen(handle)+1;
> +	int hl = (int)strlen(handle) + 1;
>  	if (*len < hl) {
>  		if (*retval != NULL)
>  			GDKfree(*retval);
> -		*retval = GDKmalloc(hl);
> +		*retval = GDKmalloc(sizeof(char) * hl);
>  	}
>  	*len = hl;
>  	memcpy(*retval, handle, hl);


I've seen this kind of thing quite often, but I have to ask, why?  The
standard says about the sizeof operator:
"When applied to an operand that has type char, unsigned char, or signed
char, (or a qualified version thereof) the result is 1."
So why bother multiplying with sizeof(char)?

-- 
Sjoerd Mullender

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 369 bytes
Desc: OpenPGP digital signature
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20080804/90ab6f1d/attachment.sig>


More information about the developers-list mailing list