[Opensrf-commits] r1782 - in trunk: include/opensrf src/libopensrf (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Sep 12 23:04:07 EDT 2009


Author: scottmk
Date: 2009-09-12 23:04:04 -0400 (Sat, 12 Sep 2009)
New Revision: 1782

Modified:
   trunk/include/opensrf/string_array.h
   trunk/src/libopensrf/string_array.c
Log:
Changed the signature of osrfStringArrayGetString():

1. It receives a pointer to osrfStringArray.  That pointer
is now a pointer to const.

2. It returns a character pointer.  That pointer is now a
pointer to const.

I have already examined all existing calls to this function,
and modified them where necessary.


Modified: trunk/include/opensrf/string_array.h
===================================================================
--- trunk/include/opensrf/string_array.h	2009-09-13 01:51:12 UTC (rev 1781)
+++ trunk/include/opensrf/string_array.h	2009-09-13 03:04:04 UTC (rev 1782)
@@ -45,7 +45,7 @@
 
 void osrfStringArrayAdd( osrfStringArray*, const char* str );
 
-char* osrfStringArrayGetString( osrfStringArray* arr, int index );
+const char* osrfStringArrayGetString( const osrfStringArray* arr, int index );
 
 int osrfStringArrayContains(
 	const osrfStringArray* arr, const char* string );

Modified: trunk/src/libopensrf/string_array.c
===================================================================
--- trunk/src/libopensrf/string_array.c	2009-09-13 01:51:12 UTC (rev 1781)
+++ trunk/src/libopensrf/string_array.c	2009-09-13 03:04:04 UTC (rev 1782)
@@ -72,11 +72,8 @@
 	@param index A zero-based index into the array
 	@return A pointer to the string stored at the specified position. if it exists;
 		or else NULL.
-
-	The calling code should treat the returned pointer as if it were const.  Some day,
-	maybe it will be.
 */
-char* osrfStringArrayGetString( osrfStringArray* arr, int index ) {
+const char* osrfStringArrayGetString( const osrfStringArray* arr, int index ) {
     if(!arr) return NULL;
 	return OSRF_LIST_GET_INDEX(&arr->list, index);
 }



More information about the opensrf-commits mailing list