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
cdo
Commits
12e21530
Commit
12e21530
authored
Jan 16, 2018
by
Uwe Schulzweida
Browse files
Replace changed Realloc to vector::reserve.
parent
3a6b52b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Pack.cc
View file @
12e21530
...
...
@@ -86,7 +86,6 @@ void *Pack(void *argument)
int
nalloc
=
0
;
int
datatype
=
CDI_DATATYPE_INT16
;
dtlist_type
*
dtlist
=
dtlist_new
();
field_type
***
vars
=
NULL
;
cdoInitialize
(
argument
);
...
...
@@ -104,13 +103,15 @@ void *Pack(void *argument)
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
varIsConst
[
varID
]
=
vlistInqVarTimetype
(
vlistID1
,
varID
)
==
TIME_CONSTANT
;
std
::
vector
<
field_type
**>
vars
;
int
tsID
=
0
;
while
(
(
nrecs
=
pstreamInqTimestep
(
streamID1
,
tsID
))
)
{
if
(
tsID
>=
nalloc
)
{
nalloc
+=
NALLOC_INC
;
vars
=
(
field_type
***
)
Realloc
(
vars
,
nalloc
*
sizeof
(
field_type
**
)
);
vars
.
reserve
(
nalloc
);
}
dtlist_taxisInqTimestep
(
dtlist
,
taxisID1
,
tsID
);
...
...
@@ -259,8 +260,6 @@ void *Pack(void *argument)
field_free
(
vars
[
tsID
],
vlistID1
);
}
if
(
vars
)
Free
(
vars
);
dtlist_delete
(
dtlist
);
pstreamClose
(
streamID2
);
...
...
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