From 97592be24c686a5f5619a623c2be509fdad857f5 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 25 Oct 2007 12:04:05 +0000 Subject: [PATCH] Patch from Scott McKellar to clean up some const qualification and initialize a pointer to NULL. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1113 9efc2488-bf62-4759-914b-345cdb29e865 --- include/opensrf/osrf_settings.h | 8 ++++---- src/libopensrf/osrf_settings.c | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/opensrf/osrf_settings.h b/include/opensrf/osrf_settings.h index d0e23df..94b399f 100644 --- a/include/opensrf/osrf_settings.h +++ b/include/opensrf/osrf_settings.h @@ -20,11 +20,11 @@ typedef struct { } osrf_host_config; -osrf_host_config* osrf_settings_new_host_config(char* hostname); +osrf_host_config* osrf_settings_new_host_config(const char* hostname); void osrf_settings_free_host_config(osrf_host_config*); -char* osrf_settings_host_value(char* path, ...); -jsonObject* osrf_settings_host_value_object(char* format, ...); -int osrf_settings_retrieve(char* hostname); +char* osrf_settings_host_value(const char* path, ...); +jsonObject* osrf_settings_host_value_object(const char* format, ...); +int osrf_settings_retrieve(const char* hostname); #endif diff --git a/src/libopensrf/osrf_settings.c b/src/libopensrf/osrf_settings.c index a732b08..9b9f944 100644 --- a/src/libopensrf/osrf_settings.c +++ b/src/libopensrf/osrf_settings.c @@ -2,7 +2,7 @@ osrf_host_config* config = NULL; -char* osrf_settings_host_value(char* format, ...) { +char* osrf_settings_host_value(const char* format, ...) { VA_LIST_TO_STRING(format); if( ! config ) { @@ -18,7 +18,7 @@ char* osrf_settings_host_value(char* format, ...) { return val; } -jsonObject* osrf_settings_host_value_object(char* format, ...) { +jsonObject* osrf_settings_host_value_object(const char* format, ...) { VA_LIST_TO_STRING(format); if( ! config ) { @@ -32,7 +32,7 @@ jsonObject* osrf_settings_host_value_object(char* format, ...) { } -int osrf_settings_retrieve(char* hostname) { +int osrf_settings_retrieve(const char* hostname) { if(!config) { @@ -72,10 +72,11 @@ int osrf_settings_retrieve(char* hostname) { return 0; } -osrf_host_config* osrf_settings_new_host_config(char* hostname) { +osrf_host_config* osrf_settings_new_host_config(const char* hostname) { if(!hostname) return NULL; osrf_host_config* c = safe_malloc(sizeof(osrf_host_config)); c->hostname = strdup(hostname); + c->config = NULL; return c; } -- 2.11.0