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
libcdi
Commits
cea3faf1
Commit
cea3faf1
authored
Dec 07, 2015
by
Thomas Jahns
🤸
Browse files
Extend memory re-use.
parent
d23bba22
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/grid.c
View file @
cea3faf1
...
...
@@ -4731,6 +4731,7 @@ gridCompareSearch(int id, void *res, void *data)
return
CDI_APPLY_GO_ON
;
}
/* Add grid (which must be Malloc'ed to vlist if not already found */
struct
addIffNewRes
cdiVlistAddGridIfNew
(
int
vlistID
,
grid_t
*
grid
,
int
mode
)
{
/*
...
...
src/stream_cdf.c
View file @
cea3faf1
...
...
@@ -4456,6 +4456,7 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
size_t
attlen
;
char
attname
[
CDI_MAX_NAME
];
double
datt
;
grid_t
*
restrict
grid
=
NULL
,
*
restrict
proj
=
NULL
;
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
++
ncvarid
)
{
...
...
@@ -4540,10 +4541,10 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
if
(
ncvars
[
ncvarid
].
gridtype
==
UNDEFID
||
ncvars
[
ncvarid
].
gridtype
==
GRID_GENERIC
)
if
(
xdimid
!=
UNDEFID
&&
xdimid
==
ydimid
&&
nydims
==
0
)
ncvars
[
ncvarid
].
gridtype
=
GRID_UNSTRUCTURED
;
grid_t
*
restrict
grid
=
(
grid_t
*
)
M
alloc
(
sizeof
(
*
grid
));
grid
=
(
grid_t
*
)
Re
alloc
(
grid
,
sizeof
(
*
grid
));
grid_init
(
grid
);
cdiGridTypeInit
(
grid
,
ncvars
[
ncvarid
].
gridtype
,
0
);
grid_t
*
restrict
proj
=
(
grid_t
*
)
M
alloc
(
sizeof
(
*
proj
));
proj
=
(
grid_t
*
)
Re
alloc
(
proj
,
sizeof
(
*
proj
));
grid_init
(
proj
);
cdiGridTypeInit
(
grid
,
GRID_PROJECTION
,
0
);
...
...
@@ -5142,18 +5143,14 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
}
}
if
(
!
gridAdded
.
isNew
)
{
grid_free
(
grid
);
Free
(
grid
);
}
if
(
!
projAdded
.
isNew
)
{
grid_free
(
proj
);
Free
(
proj
);
}
if
(
gridAdded
.
isNew
)
grid
=
NULL
;
if
(
projAdded
.
isNew
)
proj
=
NULL
;
}
}
Free
(
grid
);
Free
(
proj
);
}
/* define all input zaxes */
...
...
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