From 9b362feb87e3240305784bf86888629d1cb43655 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 11 Apr 2008 15:13:57 +0000 Subject: [PATCH] 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 --- include/opensrf/osrf_hash.h | 5 +++++ src/libopensrf/osrf_hash.c | 5 +++++ 2 files changed, 10 insertions(+) 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 @@ -83,6 +83,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 */ 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'; -- 2.43.2