used utility function.
The old version accepted a variable number of arguments: a pointer
to an osrfHash, a string optionally containing printf-style
format specifiers, and addtional parameters as needed to fill in
the blanks.
In practice, none of the code ever uses the printf-style formatting.
We always pass exactly two parameters. We burn CPU cycles scanning
the string for format specifiers and never find any.
I eliminated the unused variable parameters and turned osrfHashGet()
into a simple two-parameter function. Just in case anybody ever
wants it, I also cloned the original version into a new function
named osrfHashGetFmt, which accepts a variable number of arguments
as before.
Note that, since the signature of the function is changing,
it is necessary to recompile any open-ils programs that
call it, namely:
oils_dataloader.c
oils_event.c
oils_idl-core.c
oils_cstore.c
dump_idl.c
The Makefiles apparently don't recognize this dependency.
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1726
9efc2488-bf62-4759-914b-
345cdb29e865
*/
void* osrfHashRemove( osrfHash* hash, const char* key, ... );
-void* osrfHashGet( osrfHash* hash, const char* key, ... );
+void* osrfHashGet( osrfHash* hash, const char* key );
+void* osrfHashGetFmt( osrfHash* hash, const char* key, ... );
/**
@return A list of strings representing the keys of the hash.
}
-void* osrfHashGet( osrfHash* hash, const char* key, ... ) {
+void* osrfHashGet( osrfHash* hash, const char* key ) {
+ osrfHashNode* node = find_item( hash, key, NULL );
+ if( !node ) return NULL;
+ return node->item;
+}
+
+void* osrfHashGetFmt( osrfHash* hash, const char* key, ... ) {
if(!(hash && key )) return NULL;
VA_LIST_TO_STRING(key);