[PATCH] parsers: fix typing and sign issues

Matt Mackall mpm at selenic.com
Tue Sep 9 15:58:17 CDT 2014

On Sat, 2014-09-06 at 22:25 +0200, Henrik Stuart wrote:
> # HG changeset patch
> # User Henrik Stuart <hg at hstuart.dk>
> # Date 1410029932 -7200
> #      Sat Sep 06 20:58:52 2014 +0200
> # Node ID 41abcba2e5d08ac00abf2df5f6cbe2fe3a7e2e6e
> # Parent  c5df4af17110838b713d6c9ec3b824fb0b6c1b33
> parsers: fix typing and sign issues
> Normalized the use of types in the parser to avoid signed/unsigned mismatches
> and normalized const-ness call to free to omit warnings with both gcc and
> Microsoft Visual C++.

> -		free(self->offsets);
> +		free((char**)self->offsets);

Bleck. I can't get GCC to give a warning about this, can you?

It might just be better to remove the const on self->offsets, as the C
standard really isn't up to the task of handling const-correctness on
doubly-indirect pointers and people like me are inclined to remove
apparently useless casts like this on sight.

(people who are curious about the language lawyer details can start
here: http://c-faq.com/ansi/constmismatch.html )

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list