Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
74f7a0c1
Commit
74f7a0c1
authored
Oct 28, 2016
by
Uwe Schulzweida
Browse files
Moved pml_search_kvl_ventry() and pml_get_kvl_ventry() to pmlist.c.
parent
4d9e7157
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/CMOR_lite.c
View file @
74f7a0c1
...
...
@@ -109,54 +109,6 @@ void defineVarUnits(var_t *vars, int vlistID2, int varID, const char *units)
}
}
list_t
*
pml_search_kvl_ventry
(
list_t
*
pml
,
const
char
*
key
,
const
char
*
value
,
int
nentry
,
const
char
**
entry
)
{
if
(
pml
&&
key
&&
value
)
{
listNode_t
*
node
=
pml
->
head
;
while
(
node
)
{
if
(
node
->
data
)
{
list_t
*
kvl
=
*
(
list_t
**
)
node
->
data
;
const
char
*
listname
=
list_name
(
kvl
);
for
(
int
i
=
0
;
i
<
nentry
;
++
i
)
if
(
strcmp
(
listname
,
entry
[
i
])
==
0
)
{
keyValues_t
*
kv
=
kvlist_search
(
kvl
,
key
);
if
(
kv
&&
kv
->
nvalues
>
0
&&
*
(
kv
->
values
[
0
])
==
*
value
&&
strcmp
(
kv
->
values
[
0
],
value
)
==
0
)
return
kvl
;
}
}
node
=
node
->
next
;
}
}
return
NULL
;
}
list_t
*
pml_get_kvl_ventry
(
list_t
*
pml
,
int
nentry
,
const
char
**
entry
)
{
if
(
pml
)
{
listNode_t
*
node
=
pml
->
head
;
while
(
node
)
{
if
(
node
->
data
)
{
list_t
*
kvl
=
*
(
list_t
**
)
node
->
data
;
const
char
*
listname
=
list_name
(
kvl
);
for
(
int
i
=
0
;
i
<
nentry
;
++
i
)
if
(
strcmp
(
listname
,
entry
[
i
])
==
0
)
return
kvl
;
}
node
=
node
->
next
;
}
}
return
NULL
;
}
static
void
apply_cmor_table
(
const
char
*
filename
,
int
nvars
,
int
vlistID2
,
var_t
*
vars
)
{
...
...
src/pmlist.c
View file @
74f7a0c1
...
...
@@ -151,6 +151,55 @@ int kvlist_parse_cmdline(list_t *kvl, int nparams, char **params)
return
0
;
}
list_t
*
pml_search_kvl_ventry
(
list_t
*
pml
,
const
char
*
key
,
const
char
*
value
,
int
nentry
,
const
char
**
entry
)
{
if
(
pml
&&
key
&&
value
)
{
listNode_t
*
node
=
pml
->
head
;
while
(
node
)
{
if
(
node
->
data
)
{
list_t
*
kvl
=
*
(
list_t
**
)
node
->
data
;
const
char
*
listname
=
list_name
(
kvl
);
for
(
int
i
=
0
;
i
<
nentry
;
++
i
)
if
(
strcmp
(
listname
,
entry
[
i
])
==
0
)
{
keyValues_t
*
kv
=
kvlist_search
(
kvl
,
key
);
if
(
kv
&&
kv
->
nvalues
>
0
&&
*
(
kv
->
values
[
0
])
==
*
value
&&
strcmp
(
kv
->
values
[
0
],
value
)
==
0
)
return
kvl
;
}
}
node
=
node
->
next
;
}
}
return
NULL
;
}
list_t
*
pml_get_kvl_ventry
(
list_t
*
pml
,
int
nentry
,
const
char
**
entry
)
{
if
(
pml
)
{
listNode_t
*
node
=
pml
->
head
;
while
(
node
)
{
if
(
node
->
data
)
{
list_t
*
kvl
=
*
(
list_t
**
)
node
->
data
;
const
char
*
listname
=
list_name
(
kvl
);
for
(
int
i
=
0
;
i
<
nentry
;
++
i
)
if
(
strcmp
(
listname
,
entry
[
i
])
==
0
)
return
kvl
;
}
node
=
node
->
next
;
}
}
return
NULL
;
}
/*
int main(void)
{
...
...
src/pmlist.h
View file @
74f7a0c1
...
...
@@ -25,4 +25,7 @@ void kvlist_destroy(list_t *list);
void
kvlist_append
(
list_t
*
kvl
,
const
char
*
key
,
const
char
**
values
,
int
nvalues
);
int
kvlist_parse_cmdline
(
list_t
*
kvl
,
int
nparams
,
char
**
params
);
list_t
*
pml_search_kvl_ventry
(
list_t
*
pml
,
const
char
*
key
,
const
char
*
value
,
int
nentry
,
const
char
**
entry
);
list_t
*
pml_get_kvl_ventry
(
list_t
*
pml
,
int
nentry
,
const
char
**
entry
);
#endif
Write
Preview
Supports
Markdown
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