From 9c47cab0dd8728ee979c77b1751b94f5ce74de8d Mon Sep 17 00:00:00 2001 From: allen Date: Fri, 11 May 2001 16:48:35 +0000 Subject: Fixes for elliptic database git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllBase/trunk@55 57bc7290-fb3d-4efd-a9b1-28e84cce6043 --- src/Ell_DBstructure.c | 10 ++++++---- src/Ell_DBstructure.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Ell_DBstructure.c b/src/Ell_DBstructure.c index 48c79dd..745763b 100644 --- a/src/Ell_DBstructure.c +++ b/src/Ell_DBstructure.c @@ -207,7 +207,7 @@ int Ell_SetStrKey(char *value, const char *keychain) { } else { setme->type = CCTK_VARIABLE_STRING; - setme->vals.s = value; + setme->vals.s = strdup(value); setme->been_set = ELL_YES; retval=0; } @@ -301,11 +301,13 @@ void CCTK_FCALL CCTK_FNAME(Ell_GetIntKey) free(key); } -int Ell_GetStrKey(char *value, const char *keychain) { +int Ell_GetStrKey(char **value, const char *keychain) { struct t_ellthingy *getme=NULL; int retval; + *value = NULL; + getme = (struct t_ellthingy*)GetNamedData(EllInfoDB, keychain); if (!(getme)) { @@ -314,7 +316,7 @@ int Ell_GetStrKey(char *value, const char *keychain) { retval = ELLGET_NOKEY; } else if (getme->type!=CCTK_VARIABLE_STRING) { - printf("You are not getting a CCTK_REAL value off this key: >%s< type: %d\n", + printf("You are not getting a CCTK_STRING value off this key: >%s< type: %d\n", keychain,getme->type); retval = ELLGET_BADTYPE; } @@ -322,7 +324,7 @@ int Ell_GetStrKey(char *value, const char *keychain) { printf("Key has not been set\n"); retval = ELLGET_NOTSET; } else { - *value=getme->vals.r; + *value=strdup(getme->vals.s); retval=0; } return(retval); diff --git a/src/Ell_DBstructure.h b/src/Ell_DBstructure.h index 30eb83f..1f4af09 100644 --- a/src/Ell_DBstructure.h +++ b/src/Ell_DBstructure.h @@ -35,7 +35,7 @@ int Ell_SetStrKey(char *value, const char *keychain); int Ell_GetRealKey(CCTK_REAL *value, const char *keychain); int Ell_GetIntKey(CCTK_INT *value,const char *keychain); -int Ell_GetStrKey(char *value, const char *keychain); +int Ell_GetStrKey(char **value, const char *keychain); #ifdef __cplusplus -- cgit v1.2.3