"Jasper St. Pierre" <jstpie...@mecheye.net> writes:

> 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 *`.

In a new project, that would be lovely. In this case, we're often
storing string constants *or* allocated memory in the same struct
member, and the decision to free is generally based on external
knowledge of whether the storage was allocated or not.

So, there's going to be a cast somewhere, I just prefer the cast to be
in the call to free rather than the assignment of the constant string.

-- 
keith.pack...@intel.com

Attachment: pgp4xkfPSgyjZ.pgp
Description: PGP signature

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to