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
315cf517
Commit
315cf517
authored
10 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Use unsigned for namespace counts.
parent
4d9e79ae
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/namespace.c
+11
-10
11 additions, 10 deletions
src/namespace.c
with
11 additions
and
10 deletions
src/namespace.c
+
11
−
10
View file @
315cf517
...
...
@@ -21,7 +21,7 @@
#include
"cdi_int.h"
#include
"stream_cdf.h"
static
int
nNamespaces
=
1
;
static
unsigned
nNamespaces
=
1
;
static
int
activeNamespace
=
0
;
#ifdef HAVE_LIBNETCDF
...
...
@@ -72,7 +72,7 @@ static struct Namespace
static
struct
Namespace
*
namespaces
=
&
initialNamespace
;
static
int
namespacesSize
=
1
;
static
unsigned
namespacesSize
=
1
;
#if defined (HAVE_LIBPTHREAD)
# include <pthread.h>
...
...
@@ -151,10 +151,10 @@ namespaceNew()
if
(
namespacesSize
>
nNamespaces
)
{
/* namespace is already available and only needs reinitialization */
for
(
int
i
=
0
;
i
<
namespacesSize
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
namespacesSize
;
++
i
)
if
(
namespaces
[
i
].
resStage
==
STAGE_UNUSED
)
{
newNamespaceID
=
i
;
newNamespaceID
=
(
int
)
i
;
break
;
}
}
...
...
@@ -171,7 +171,7 @@ namespaceNew()
else
if
(
namespacesSize
<
NUM_NAMESPACES
)
{
/* make room for additional namespace */
newNamespaceID
=
namespacesSize
;
newNamespaceID
=
(
int
)
namespacesSize
;
namespaces
=
(
struct
Namespace
*
)
xrealloc
(
namespaces
,
((
size_t
)
namespacesSize
+
1
)
*
sizeof
(
namespaces
[
0
]));
++
namespacesSize
;
...
...
@@ -203,7 +203,8 @@ namespaceDelete(int namespaceID)
{
NAMESPACE_INIT
();
NAMESPACE_LOCK
();
xassert
(
namespaceID
<
namespacesSize
&&
nNamespaces
);
xassert
(
namespaceID
>=
0
&&
(
unsigned
)
namespaceID
<
namespacesSize
&&
nNamespaces
);
reshListDestruct
(
namespaceID
);
namespaces
[
namespaceID
].
resStage
=
STAGE_UNUSED
;
--
nNamespaces
;
...
...
@@ -212,13 +213,13 @@ namespaceDelete(int namespaceID)
int
namespaceGetNumber
()
{
return
nNamespaces
;
return
(
int
)
nNamespaces
;
}
void
namespaceSetActive
(
int
nId
)
{
xassert
(
nId
<
namespacesSize
&&
nId
>=
0
xassert
(
(
unsigned
)
nId
<
namespacesSize
&&
namespaces
[
nId
].
resStage
!=
STAGE_UNUSED
);
activeNamespace
=
nId
;
}
...
...
@@ -294,9 +295,9 @@ void cdiReset(void)
{
NAMESPACE_INIT
();
NAMESPACE_LOCK
();
for
(
int
namespaceID
=
0
;
namespaceID
<
namespacesSize
;
++
namespaceID
)
for
(
unsigned
namespaceID
=
0
;
namespaceID
<
namespacesSize
;
++
namespaceID
)
if
(
namespaces
[
namespaceID
].
resStage
!=
STAGE_UNUSED
)
namespaceDelete
(
namespaceID
);
namespaceDelete
(
(
int
)
namespaceID
);
if
(
namespaces
!=
&
initialNamespace
)
{
free
(
namespaces
);
...
...
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