<div dir="ltr">The warnings are trying to prevent you from freeing a string constant and having corrupt memory or double frees or worse. Casts are a *very* bad way to work around the issue, and I'd highly recommend that if you want to potentially free something, you use `char *`, not `const char *`.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 10:42 AM, Keith Packard <span dir="ltr"><<a href="mailto:keithp@keithp.com" target="_blank">keithp@keithp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Thierry Reding <<a href="mailto:thierry.reding@gmail.com">thierry.reding@gmail.com</a>> writes:<br>
<br>
> Of course to make proper use of that, quite a bit of code will need to<br>
> be changed first.<br>
<br>
</div>Having miles of compiler warning spam is not helpful though, so we need<br>
to tailor the warning set to those which are actually useful for a<br>
particular project. In this case, X uses the same data structures to<br>
hold both string constants and allocated memory. I can think of lots of<br>
fixes for this, but simply sticking a cast in the free parameter seems<br>
the least invasive to me, while preserving most of the checks. Having to<br>
hack around the -Wcast-qual check with an intermediate cast to<br>
(uintptr_t) seems silly.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<a href="mailto:keith.packard@intel.com">keith.packard@intel.com</a><br>
</font></span><br>_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br></blockquote></div><br><br clear="all"><br>-- <br> Jasper<br>
</div>