[OPEN-ILS-DEV] PATCH: osrf_json_tools.c (const-correctness)

Mike Rylander mrylander at gmail.com
Mon Aug 27 20:38:26 EDT 2007


On 8/26/07, Scott McKellar <mck9 at swbell.net> wrote:
> This patch adds const qualifiers to the parameters of a couple of
> functions: the global function jsonObjectEncodeClass() and the
> underlying static function _jsonObjectEncodeClass().  A companion patch
> updates the prototype in the corresponding header file.
>
> The _jsonObjectEncodeClass function does not change the contents of the
> jsonObject upon which it operates; rather it creates a new jsonObject
> derived from the original.  Hence it can accept a const pointer in
> good conscience, as can its wrapper function jsonObjectEncodeClass().
>
> This patch will not change the behavior of anything.  However it will
> enable us to remove at least one cast (in jsonObjectToJSON()) that is
> present solely to remove constness.  Casts in general are
> unfashionable,
> and a cast that removes constness is likely to raise eyebrows, even if
> (as in this case) it turns out to be benign.

Agreed, and committed.  Thank you, sir.

-- 
Mike Rylander
Equinox Software, Inc
miker at esilibrary.com
http://esilibrary.com/


More information about the Open-ils-dev mailing list