osrfCachePutString has the argument key marked as char* where it could be a const char*
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenSRF |
Fix Released
|
Low
|
Unassigned |
Bug Description
In osrf_cache.c, line 55 (or so), we have the following definition of osrfCachePutString:
int osrfCachePutString( char* key, const char* value, time_t seconds )
There seems to be no reason for the key parameter to be marked as const char*, as it is only really passed to memcached_set, which also takes a pointer to const char (See http://
This isn't really a bug in the sense that it breaks anything; theoretically marking key as const char* might allow the compiler to optimize something, but the performance gains are irrelevant. However, anyone wanting to pass a const char* to osrfCachePutString needs to currently cast it char*, which is ugly.
Changed in opensrf: | |
importance: | Undecided → Low |
Changed in opensrf: | |
status: | Fix Committed → Fix Released |
I've pushed a patch to improve the const-correctness of osrfCachePut{ String, Object} to the user/gmcharlt/ lp1234816_ osrfCachePutStr ing_const branch of the working/OpenSRF repository:
http:// git.evergreen- ils.org/ ?p=working/ OpenSRF. git;a=shortlog; h=refs/ heads/user/ gmcharlt/ lp1234816_ osrfCachePutStr ing_const