[OPEN-ILS-DEV] Re: PATCH: osrf_json_object.[ch] (const-correctness)

Scott McKellar mck9 at swbell.net
Sat Sep 22 11:51:29 EDT 2007


This patch is the first step in the program outlined below:

> > 1. Clone jsonObjectGetKey() to form jsonObjectGetKeyConst().  This
> > new function would be identical to jsonObjectGetKey() except that
> it
> > would return a const pointer.
> >
> > 2. Identify all the places that currently call jsonObjectGetKey().
> > Wherever the code passes a pointer to a const jsonObject, call the
> > new function instead.  It will probably be necessary to make some
> > other changes along the way to keep everything const-correct.
> >
> > 3. Change the original function so that it receives a pointer to a
> > non-const jsonObject.  Then the compiler won't let you pass a
> > const pointer to it without a cast.
> 
> 
> I have no objections to this 3-step program, but I also think just
> doing
> step 3 is sufficient.

Step 3 is not sufficient because sometimes we pass a pointer to a
jsonObject that really is const -- although I don't think we use
the returned pointer to change the jsonObject in those cases.

I have submitted three previous patches to these files (one to the 
header and two to the .c) that appear not to have been applied to 
the Evergreen repository.  The present patches were built from my
updated versions and do not, themselves, reflect the changes I 
proposed earlier.  However the various changes are sufficiently
independent that I think the present patches will work anyway, in
isolation from the others.

----------

I haven't been following the acquisitions stuff closely, but I do
have one question:

How much wood would Woodchip chip, if Woodchip could chip wood?

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_h_2.patch
Type: text/x-patch
Size: 554 bytes
Desc: 951356648-osrf_json_h_2.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070922/d115b0c6/osrf_json_h_2.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_json_object_c_3.patch
Type: text/x-patch
Size: 623 bytes
Desc: 2692694715-osrf_json_object_c_3.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070922/d115b0c6/osrf_json_object_c_3.bin


More information about the Open-ils-dev mailing list