Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
49d7092b
Commit
49d7092b
authored
7 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Consolidate vlistDestroy error checking.
parent
69434573
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/stream.c
+1
-1
1 addition, 1 deletion
src/stream.c
src/vlist.c
+20
-19
20 additions, 19 deletions
src/vlist.c
src/vlist.h
+1
-1
1 addition, 1 deletion
src/vlist.h
with
22 additions
and
21 deletions
src/stream.c
+
1
−
1
View file @
49d7092b
...
...
@@ -1069,7 +1069,7 @@ void streamClose(int streamID)
if
(
streamptr
->
filemode
!=
'w'
&&
vlistInqTaxis
(
vlistID
)
!=
-
1
)
taxisDestroy
(
vlistInqTaxis
(
vlistID
));
cdiVlistDestroy_
(
vlistID
);
cdiVlistDestroy_
(
vlistID
,
true
);
}
stream_delete_entry
(
streamptr
);
...
...
This diff is collapsed.
Click to expand it.
src/vlist.c
+
20
−
19
View file @
49d7092b
...
...
@@ -251,6 +251,25 @@ vlist_delete(vlist_t *vlistptr)
vlist_delete_entry
(
vlistptr
);
}
// destroy a vlist object
void
cdiVlistDestroy_
(
int
vlistID
,
bool
assertInternal
)
{
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
static
const
char
warningTextUserByInternal
[]
=
"Destroying a vlist object that is owned by the user (vlistID=%d).
\n
"
"This is most likely because of a missing vlistDestroy() in the application code.
\n
"
"If that's not the case, and you are absolutely certain about it, please report the bug."
,
warningTextInternalByUser
[]
=
"Attempt to destroy an internal vlist object by the user (vlistID=%d)."
;
static
const
char
*
const
wText
[
2
]
=
{
warningTextUserByInternal
,
warningTextInternalByUser
};
if
(
vlistptr
->
internal
==
assertInternal
)
vlist_delete
(
vlistptr
);
else
Warning
(
wText
[
!
assertInternal
],
vlistID
);
}
/*
@Function vlistDestroy
...
...
@@ -264,25 +283,7 @@ vlist_delete(vlist_t *vlistptr)
*/
void
vlistDestroy
(
int
vlistID
)
{
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
if
(
vlistptr
->
internal
)
Warning
(
"Attempt to destroy an internal vlist object by the user (vlistID=%d)."
,
vlistID
);
else
vlist_delete
(
vlistptr
);
}
// destroy an internal vlist object
void
cdiVlistDestroy_
(
int
vlistID
)
{
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
if
(
!
vlistptr
->
internal
)
Warning
(
"Destroying a vlist object that is owned by the user.
\n
"
"This is most likely because of a missing vlistDestroy() in the application code.
\n
"
"If that's not the case, and you are absolutely certain about it, please report the bug."
);
vlist_delete
(
vlistptr
);
cdiVlistDestroy_
(
vlistID
,
false
);
}
static
...
...
This diff is collapsed.
Click to expand it.
src/vlist.h
+
1
−
1
View file @
49d7092b
...
...
@@ -126,7 +126,7 @@ void vlistDestroyVarName(int vlistID, int varID);
void
vlistDestroyVarLongname
(
int
vlistID
,
int
varID
);
void
vlistDestroyVarStdname
(
int
vlistID
,
int
varID
);
void
vlistDestroyVarUnits
(
int
vlistID
,
int
varID
);
void
cdiVlistDestroy_
(
int
vlistID
);
void
cdiVlistDestroy_
(
int
vlistID
,
bool
assertInternal
);
void
vlistDefVarTsteptype
(
int
vlistID
,
int
varID
,
int
tsteptype
);
int
vlistInqVarMissvalUsed
(
int
vlistID
,
int
varID
);
int
vlistHasTime
(
int
vlistID
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment