Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
693f0f3d
Commit
693f0f3d
authored
Nov 12, 2019
by
Uwe Schulzweida
Browse files
Added cdiInitKeys().
parent
f927d7da
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cdi_key.c
View file @
693f0f3d
...
...
@@ -574,6 +574,14 @@ const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key)
return
NULL
;
}
void
cdiInitKeys
(
cdi_keys_t
*
keysp
)
{
keysp
->
nalloc
=
MAX_KEYS
;
keysp
->
nelems
=
0
;
for
(
int
i
=
0
;
i
<
MAX_KEYS
;
++
i
)
keysp
->
value
[
i
].
length
=
0
;
}
/*
* Local Variables:
* c-file-style: "Java"
...
...
src/cdi_key.h
View file @
693f0f3d
...
...
@@ -56,6 +56,8 @@ void cdiDeleteVarKeys(cdi_keys_t *keysp);
void
cdiDeleteKeys
(
int
cdiID
,
int
varID
);
void
cdiPrintKeys
(
int
cdiID
,
int
varID
);
void
cdiInitKeys
(
cdi_keys_t
*
keysp
);
#endif
/*
...
...
src/grid.c
View file @
693f0f3d
...
...
@@ -127,10 +127,7 @@ void grid_axis_init(struct gridaxis_t *axisptr)
axisptr
->
cvals
=
NULL
;
#endif
axisptr
->
stdname
=
NULL
;
axisptr
->
keys
.
nalloc
=
MAX_KEYS
;
axisptr
->
keys
.
nelems
=
0
;
for
(
int
i
=
0
;
i
<
MAX_KEYS
;
++
i
)
axisptr
->
keys
.
value
[
i
].
length
=
0
;
cdiInitKeys
(
&
axisptr
->
keys
);
}
void
grid_init
(
grid_t
*
gridptr
)
...
...
@@ -168,10 +165,7 @@ void grid_init(grid_t *gridptr)
gridptr
->
hasdims
=
true
;
gridptr
->
name
=
NULL
;
gridptr
->
vtable
=
&
cdiGridVtable
;
gridptr
->
keys
.
nalloc
=
MAX_KEYS
;
gridptr
->
keys
.
nelems
=
0
;
for
(
int
i
=
0
;
i
<
MAX_KEYS
;
++
i
)
gridptr
->
keys
.
value
[
i
].
length
=
0
;
cdiInitKeys
(
&
gridptr
->
keys
);
gridptr
->
atts
.
nalloc
=
MAX_ATTRIBUTES
;
gridptr
->
atts
.
nelems
=
0
;
gridptr
->
iScansNegatively
=
0
;
...
...
@@ -248,11 +242,11 @@ void grid_copy_base_scalar_fields(grid_t *gridptrOrig, grid_t *gridptrDup)
{
memcpy
(
gridptrDup
,
gridptrOrig
,
sizeof
(
grid_t
));
gridptrDup
->
self
=
CDI_UNDEFID
;
gridptrDup
->
keys
.
nelems
=
0
;
cdiInitKeys
(
&
gridptrDup
->
keys
)
;
cdiCopyVarKeys
(
&
gridptrOrig
->
keys
,
&
gridptrDup
->
keys
);
gridptrDup
->
x
.
keys
.
nelems
=
0
;
cdiInitKeys
(
&
gridptrDup
->
x
.
keys
)
;
cdiCopyVarKeys
(
&
gridptrOrig
->
x
.
keys
,
&
gridptrDup
->
x
.
keys
);
gridptrDup
->
y
.
keys
.
nelems
=
0
;
cdiInitKeys
(
&
gridptrDup
->
y
.
keys
)
;
cdiCopyVarKeys
(
&
gridptrOrig
->
y
.
keys
,
&
gridptrDup
->
y
.
keys
);
if
(
gridptrOrig
->
reference
)
gridptrDup
->
reference
=
strdupx
(
gridptrOrig
->
reference
);
}
...
...
src/varscan.c
View file @
693f0f3d
...
...
@@ -113,8 +113,7 @@ void paramInitEntry(unsigned varID, int param)
vartable
[
varID
].
instID
=
CDI_UNDEFID
;
vartable
[
varID
].
modelID
=
CDI_UNDEFID
;
vartable
[
varID
].
tableID
=
CDI_UNDEFID
;
vartable
[
varID
].
keys
.
nalloc
=
MAX_KEYS
;
vartable
[
varID
].
keys
.
nelems
=
0
;
cdiInitKeys
(
&
vartable
[
varID
].
keys
);
vartable
[
varID
].
comptype
=
CDI_COMPRESS_NONE
;
vartable
[
varID
].
complevel
=
1
;
vartable
[
varID
].
lmissval
=
false
;
...
...
@@ -515,7 +514,7 @@ int cmpLevelTableInv(const void* s1, const void* s2)
void
varCopyKeys
(
int
vlistID
,
int
varID
)
{
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
vlistptr
->
vars
[
varID
].
keys
.
nelems
=
0
;
cdiInitKeys
(
&
vlistptr
->
vars
[
varID
].
keys
)
;
cdiCopyVarKeys
(
&
vartable
[
varID
].
keys
,
&
vlistptr
->
vars
[
varID
].
keys
);
}
...
...
src/zaxis.c
View file @
693f0f3d
...
...
@@ -133,10 +133,7 @@ void zaxis_init(zaxis_t *zaxisptr)
zaxisptr
->
nhlev
=
0
;
memset
(
zaxisptr
->
uuid
,
0
,
CDI_UUID_SIZE
);
zaxisptr
->
keys
.
nalloc
=
MAX_KEYS
;
zaxisptr
->
keys
.
nelems
=
0
;
for
(
int
i
=
0
;
i
<
MAX_KEYS
;
++
i
)
zaxisptr
->
keys
.
value
[
i
].
length
=
0
;
cdiInitKeys
(
&
zaxisptr
->
keys
);
zaxisptr
->
atts
.
nalloc
=
MAX_ATTRIBUTES
;
zaxisptr
->
atts
.
nelems
=
0
;
}
...
...
@@ -175,7 +172,7 @@ void zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1)
const
int
zaxisID2
=
zaxisptr2
->
self
;
memcpy
(
zaxisptr2
,
zaxisptr1
,
sizeof
(
zaxis_t
));
zaxisptr2
->
self
=
zaxisID2
;
zaxisptr2
->
keys
.
nelems
=
0
;
cdiInitKeys
(
&
zaxisptr2
->
keys
)
;
cdiCopyVarKeys
(
&
zaxisptr1
->
keys
,
&
zaxisptr2
->
keys
);
}
...
...
@@ -820,6 +817,7 @@ int zaxisInqLevels(int zaxisID, double *levels)
return
size
;
}
int
zaxisInqCLen
(
int
zaxisID
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
...
...
@@ -833,6 +831,7 @@ int zaxisInqCLen(int zaxisID)
return
clen
;
}
int
zaxisInqCVals
(
int
zaxisID
,
char
***
clevels
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment