Commit fc89a571 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdiInqVarKeyString(): changed type of first parameter to const.

parent 525ef09d
......@@ -182,10 +182,10 @@ int cdiInqKeyLen(int cdiID, int varID, int key, int *length)
{
int status = -1;
cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
xassert(keysp != NULL);
const cdi_key_t *keyp = find_key(keysp, key);
const cdi_key_t *keyp = find_key_const(keysp, key);
if ( keyp != NULL )
{
*length = keyp->length;
......@@ -260,7 +260,7 @@ int cdiCopyVarKey(const cdi_keys_t *keysp1, int key, cdi_keys_t *keysp2)
{
int status = CDI_NOERR;
const cdi_key_t *keyp = find_key_const (keysp1, key);
const cdi_key_t *keyp = find_key_const(keysp1, key);
if (keyp == NULL) return -1;
cdi_define_key(keyp, keysp2);
......@@ -352,10 +352,10 @@ int cdiInqKeyInt(int cdiID, int varID, int key, int *value)
// if ( varID != CDI_GLOBAL ) status = cdiInqKeyInt(cdiID, CDI_GLOBAL, key, value);
cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
xassert(keysp != NULL);
cdi_key_t *keyp = find_key(keysp, key);
const cdi_key_t *keyp = find_key_const(keysp, key);
if ( keyp != NULL ) // key in use
{
if ( keyp->type == KEY_INT )
......@@ -451,10 +451,10 @@ int cdiInqKeyFloat(int cdiID, int varID, int key, double *value)
// if ( varID != CDI_GLOBAL ) status = cdiInqKeyFloat(cdiID, CDI_GLOBAL, key, value);
cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
xassert(keysp != NULL);
cdi_key_t *keyp = find_key(keysp, key);
const cdi_key_t *keyp = find_key_const(keysp, key);
if ( keyp != NULL ) // key in use
{
if ( keyp->type == KEY_FLOAT )
......@@ -672,9 +672,9 @@ int cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length)
return status;
}
const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key)
const char *cdiInqVarKeyStringPtr(const cdi_keys_t *keysp, int key)
{
const cdi_key_t *keyp = find_key(keysp, key);
const cdi_key_t *keyp = find_key_const(keysp, key);
if ( keyp != NULL ) // key in use
{
if ( keyp->type == KEY_BYTES ) return (const char *)keyp->v.s;
......
......@@ -31,10 +31,10 @@ int cdiInqVarKeyInt(const cdi_keys_t *keysp, int key);
int cdiInqVarKeyBytes(const cdi_keys_t *keysp, int key, unsigned char *bytes, int *length);
cdi_key_t *find_key(cdi_keys_t *keysp, int key);
const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key);
const char *cdiInqVarKeyStringPtr(const cdi_keys_t *keysp, int key);
static inline
const char *cdiInqVarKeyString(cdi_keys_t *keysp, int key)
const char *cdiInqVarKeyString(const cdi_keys_t *keysp, int key)
{
const char *string = cdiInqVarKeyStringPtr(keysp, key);
if (string == NULL) string = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment