From: miker Date: Fri, 11 Apr 2008 15:13:57 +0000 (+0000) Subject: Patch from Scott McKellar: X-Git-Tag: osrf_rel_2_0_1~660 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9b362feb87e3240305784bf86888629d1cb43655;p=OpenSRF.git Patch from Scott McKellar: This patch adds a new function so that code outside of osrf_hash.c doesn't have to directly access the "current" member of an osrfHashIterator. This bit of encapsulation will make it easier to refactor the osrfHash code. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1307 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/include/opensrf/osrf_hash.h b/include/opensrf/osrf_hash.h index b7bc55b..5cc3bb5 100644 --- a/include/opensrf/osrf_hash.h +++ b/include/opensrf/osrf_hash.h @@ -84,6 +84,11 @@ int osrfHashIteratorHasNext( osrfHashIterator* itr ); void* osrfHashIteratorNext( osrfHashIterator* itr ); /** + Returns a pointer to the key of the current hash item + */ +const char* osrfHashIteratorKey( const osrfHashIterator* itr ); + +/** Deallocates the given list */ void osrfHashIteratorFree( osrfHashIterator* itr ); diff --git a/src/libopensrf/osrf_hash.c b/src/libopensrf/osrf_hash.c index 972ccfb..e99dda3 100644 --- a/src/libopensrf/osrf_hash.c +++ b/src/libopensrf/osrf_hash.c @@ -263,6 +263,11 @@ void osrfHashIteratorFree( osrfHashIterator* itr ) { free(itr); } +const char* osrfHashIteratorKey( const osrfHashIterator* itr ) { + if( ! itr ) return NULL; + return itr->current; +} + void osrfHashIteratorReset( osrfHashIterator* itr ) { if(!itr) return; if(itr->current) itr->current[0] = '\0';