[Opensrf-commits] r1307 - in trunk: include/opensrf src/libopensrf

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 11 11:51:31 EDT 2008


Author: miker
Date: 2008-04-11 11:13:57 -0400 (Fri, 11 Apr 2008)
New Revision: 1307

Modified:
   trunk/include/opensrf/osrf_hash.h
   trunk/src/libopensrf/osrf_hash.c
Log:
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.



Modified: trunk/include/opensrf/osrf_hash.h
===================================================================
--- trunk/include/opensrf/osrf_hash.h	2008-04-11 14:58:49 UTC (rev 1306)
+++ trunk/include/opensrf/osrf_hash.h	2008-04-11 15:13:57 UTC (rev 1307)
@@ -84,6 +84,11 @@
 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 );

Modified: trunk/src/libopensrf/osrf_hash.c
===================================================================
--- trunk/src/libopensrf/osrf_hash.c	2008-04-11 14:58:49 UTC (rev 1306)
+++ trunk/src/libopensrf/osrf_hash.c	2008-04-11 15:13:57 UTC (rev 1307)
@@ -263,6 +263,11 @@
 	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';



More information about the opensrf-commits mailing list