Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sepolicy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test
platform
system
sepolicy
Commits
59b5de0b
Commit
59b5de0b
authored
7 years ago
by
Yi Kong
Committed by
android-build-merger
7 years ago
Browse files
Options
Downloads
Plain Diff
Modernize codebase by replacing NULL with nullptr
am:
16544eb9
Change-Id: I0790ed88b45665c9087562144a73cd0294cb4c31
parents
c1ebd935
16544eb9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/sepol_wrap.cpp
+21
-21
21 additions, 21 deletions
tests/sepol_wrap.cpp
with
21 additions
and
21 deletions
tests/sepol_wrap.cpp
+
21
−
21
View file @
59b5de0b
...
...
@@ -29,7 +29,7 @@ void *init_genfs_iter(void *policydbp)
if
(
!
out
)
{
std
::
cerr
<<
"Failed to allocate genfs iterator"
<<
std
::
endl
;
return
NULL
;
return
nullptr
;
}
policydb_t
*
db
=
static_cast
<
policydb_t
*>
(
policydbp
);
...
...
@@ -66,8 +66,8 @@ int get_genfs(char *out, size_t max_size, void *policydbp, void *genfs_iterp)
}
i
->
ocon
=
i
->
ocon
->
next
;
if
(
i
->
ocon
==
NULL
)
{
if
(
i
->
genfs
->
next
!=
NULL
)
{
if
(
i
->
ocon
==
nullptr
)
{
if
(
i
->
genfs
->
next
!=
nullptr
)
{
i
->
genfs
=
i
->
genfs
->
next
;
i
->
ocon
=
i
->
genfs
->
head
;
}
else
{
...
...
@@ -103,10 +103,10 @@ void *init_type_iter(void *policydbp, const char *type, bool is_attr)
if
(
!
out
)
{
std
::
cerr
<<
"Failed to allocate type type iterator"
<<
std
::
endl
;
return
NULL
;
return
nullptr
;
}
if
(
type
==
NULL
)
{
if
(
type
==
nullptr
)
{
out
->
length
=
db
->
p_types
.
nprim
;
out
->
bit
=
0
;
if
(
is_attr
)
...
...
@@ -119,11 +119,11 @@ void *init_type_iter(void *policydbp, const char *type, bool is_attr)
if
(
is_attr
&&
out
->
d
->
flavor
!=
TYPE_ATTRIB
)
{
std
::
cerr
<<
"
\"
"
<<
type
<<
"
\"
MUST be an attribute in the policy"
<<
std
::
endl
;
free
(
out
);
return
NULL
;
return
nullptr
;
}
else
if
(
!
is_attr
&&
out
->
d
->
flavor
!=
TYPE_TYPE
)
{
std
::
cerr
<<
"
\"
"
<<
type
<<
"
\"
MUST be a type in the policy"
<<
std
::
endl
;
free
(
out
);
return
NULL
;
return
nullptr
;
}
if
(
is_attr
)
{
...
...
@@ -191,14 +191,14 @@ void *load_policy(const char *policy_path)
fp
=
fopen
(
policy_path
,
"re"
);
if
(
!
fp
)
{
std
::
cerr
<<
"Invalid or non-existing policy file: "
<<
policy_path
<<
std
::
endl
;
return
NULL
;
return
nullptr
;
}
db
=
(
policydb_t
*
)
calloc
(
1
,
sizeof
(
policydb_t
));
if
(
!
db
)
{
std
::
cerr
<<
"Failed to allocate memory for policy db."
<<
std
::
endl
;
fclose
(
fp
);
return
NULL
;
return
nullptr
;
}
sidtab_t
sidtab
;
...
...
@@ -210,17 +210,17 @@ void *load_policy(const char *policy_path)
std
::
cerr
<<
"Failed to stat the policy file"
<<
std
::
endl
;
free
(
db
);
fclose
(
fp
);
return
NULL
;
return
nullptr
;
}
auto
unmap
=
[
=
](
void
*
ptr
)
{
munmap
(
ptr
,
sb
.
st_size
);
};
std
::
unique_ptr
<
void
,
decltype
(
unmap
)
>
map
(
mmap
(
NULL
,
sb
.
st_size
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
fp
),
0
),
unmap
);
mmap
(
nullptr
,
sb
.
st_size
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
fp
),
0
),
unmap
);
if
(
!
map
)
{
std
::
cerr
<<
"Failed to map the policy file"
<<
std
::
endl
;
free
(
db
);
fclose
(
fp
);
return
NULL
;
return
nullptr
;
}
struct
policy_file
pf
;
...
...
@@ -232,7 +232,7 @@ void *load_policy(const char *policy_path)
std
::
cerr
<<
"Failed to initialize policydb"
<<
std
::
endl
;
free
(
db
);
fclose
(
fp
);
return
NULL
;
return
nullptr
;
}
if
(
policydb_read
(
db
,
&
pf
,
0
))
{
...
...
@@ -240,7 +240,7 @@ void *load_policy(const char *policy_path)
policydb_destroy
(
db
);
free
(
db
);
fclose
(
fp
);
return
NULL
;
return
nullptr
;
}
return
static_cast
<
void
*>
(
db
);
...
...
@@ -266,7 +266,7 @@ static int get_avtab_allow_rule(char *out, size_t max_size, policydb_t *db,
size_t
len
;
for
(;
avtab_i
->
i
<
avtab_i
->
avtab
->
nslot
;
(
avtab_i
->
i
)
++
)
{
if
(
avtab_i
->
cur
==
NULL
)
{
if
(
avtab_i
->
cur
==
nullptr
)
{
avtab_i
->
cur
=
avtab_i
->
avtab
->
htable
[
avtab_i
->
i
];
}
for
(;
avtab_i
->
cur
;
avtab_i
->
cur
=
(
avtab_i
->
cur
)
->
next
)
{
...
...
@@ -286,7 +286,7 @@ static int get_avtab_allow_rule(char *out, size_t max_size, policydb_t *db,
}
return
0
;
}
avtab_i
->
cur
=
NULL
;
avtab_i
->
cur
=
nullptr
;
}
return
1
;
...
...
@@ -306,7 +306,7 @@ static avtab_iter *init_avtab_common(avtab_t *in)
calloc
(
1
,
sizeof
(
struct
avtab_iter
));
if
(
!
out
)
{
std
::
cerr
<<
"Failed to allocate avtab iterator"
<<
std
::
endl
;
return
NULL
;
return
nullptr
;
}
out
->
avtab
=
in
;
...
...
@@ -344,7 +344,7 @@ static avtab_iter *init_expanded_avtab_common(avtab_t *in, policydb_t *p)
calloc
(
1
,
sizeof
(
struct
avtab_iter
));
if
(
!
out
)
{
std
::
cerr
<<
"Failed to allocate avtab iterator"
<<
std
::
endl
;
return
NULL
;
return
nullptr
;
}
avtab_t
*
avtab
=
(
avtab_t
*
)
calloc
(
1
,
sizeof
(
avtab_t
));
...
...
@@ -352,7 +352,7 @@ static avtab_iter *init_expanded_avtab_common(avtab_t *in, policydb_t *p)
if
(
!
avtab
)
{
std
::
cerr
<<
"Failed to allocate avtab"
<<
std
::
endl
;
free
(
out
);
return
NULL
;
return
nullptr
;
}
out
->
avtab
=
avtab
;
...
...
@@ -360,14 +360,14 @@ static avtab_iter *init_expanded_avtab_common(avtab_t *in, policydb_t *p)
std
::
cerr
<<
"Failed to initialize avtab"
<<
std
::
endl
;
free
(
avtab
);
free
(
out
);
return
NULL
;
return
nullptr
;
}
if
(
expand_avtab
(
p
,
in
,
out
->
avtab
))
{
std
::
cerr
<<
"Failed to expand avtab"
<<
std
::
endl
;
free
(
avtab
);
free
(
out
);
return
NULL
;
return
nullptr
;
}
return
out
;
}
...
...
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