[OPEN-ILS-DEV] PATCH: osrf_cache.[ch], osrf_system.c (const-correctness)

Scott McKellar mck9 at swbell.net
Wed Oct 31 00:06:13 EDT 2007


These three patches are mutually dependent and should be committed or
rejected as a group.

The first two patches concern osrf_cache.[ch]:

1. I declared the variables __osrfCache and __osrfCacheMaxSeconds as
static, since no other file refers to them.  Also I changed the leading
double underscores to single underscores.

2. I added the const qualifier to several parameters.

3. In particular I added the const qualifier to the first parameter of
osrfCacheInit(), which is an array of pointers.  This change requires
a corresponding change in the calling code.

Fortunately only one file calls osrfCacheInit(), namely osrf_system.c,
so I can just add the const there too.  That's why all three patches
go together.  If we ever need to pass an array of truly non-const 
pointers we can find some other workaround at that time.

I would have liked to constify several other cache functions, but I
ran into problems with the underlying memcache code.  My copy of 
memcache.h says that the second parameter to mc_set() is not const.
As a result there are certain functions that I can't readily constify
without a ghastly cast.

That parameter could almost certainly be made const.  In fact I found
one version on the Net where it was indeed const.  However these
issues with third party code are more than I want to wrestle with
right now, if ever.  So I left those functions alone.

The patch to osrf_system.c constifies a few variables in order to
prepare for the day when jsonObjectGetIndex() and 
jsonObjectGetString() return const pointers.

Scott McKellar
http://home.swbell/net/mkc9/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_cache_h_1.patch
Type: text/x-patch
Size: 2080 bytes
Desc: 2419314577-osrf_cache_h_1.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20071030/3b0598f7/osrf_cache_h_1-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_cache_c_1.patch
Type: text/x-patch
Size: 4963 bytes
Desc: 49859002-osrf_cache_c_1.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20071030/3b0598f7/osrf_cache_c_1-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osrf_system_c_9.patch
Type: text/x-patch
Size: 1890 bytes
Desc: 2258339867-osrf_system_c_9.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20071030/3b0598f7/osrf_system_c_9-0001.bin


More information about the Open-ils-dev mailing list