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

Scott McKellar mck9 at swbell.net
Sun Aug 26 18:25:20 EDT 2007


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.

Scott McKellar
http://home.swbell.net/mck9/ct/

Developer's Certificate of Origin 1.1 By making a contribution to
this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license indicated
in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source license
and I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
same open source license (unless I am permitted to submit under a
different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person
who certified (a), (b) or (c) and I have not modified it; and

(d) In the case of each of (a), (b), or (c), I understand and agree
that this project and the contribution are public and that a record
of the contribution (including all personal information I submit
with it, including my sign-off) is maintained indefinitely and may
be redistributed consistent with this project or the open source
license indicated in the file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_json_tools_c.patch
Type: text/x-patch
Size: 1220 bytes
Desc: 1476113979-osrf_json_tools_c.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070826/4d377163/osrf_json_tools_c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_json_h.patch
Type: text/x-patch
Size: 1402 bytes
Desc: 1118427355-osrf_json_h.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070826/4d377163/osrf_json_h.bin


More information about the Open-ils-dev mailing list