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
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 );
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';