From d12a1a68aa6152167a3cb47d8a37cdcdf21afaef Mon Sep 17 00:00:00 2001 From: scottmk Date: Sun, 13 Sep 2009 03:04:04 +0000 Subject: [PATCH 1/1] 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. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1782 9efc2488-bf62-4759-914b-345cdb29e865 --- include/opensrf/string_array.h | 2 +- src/libopensrf/string_array.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/opensrf/string_array.h b/include/opensrf/string_array.h index 33d62a0..57675c3 100644 --- a/include/opensrf/string_array.h +++ b/include/opensrf/string_array.h @@ -45,7 +45,7 @@ osrfStringArray* osrfNewStringArray( int size ); 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 ); diff --git a/src/libopensrf/string_array.c b/src/libopensrf/string_array.c index 0f2824d..0194a28 100644 --- a/src/libopensrf/string_array.c +++ b/src/libopensrf/string_array.c @@ -72,11 +72,8 @@ void osrfStringArrayAdd( osrfStringArray* arr, const char* string ) { @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); } -- 2.43.2