mirror of
https://github.com/systemd/systemd
synced 2024-09-06 00:41:36 +00:00
basic/cap-list: reduce scope of variables
This commit is contained in:
parent
864a25d99b
commit
5700780389
|
@ -18,7 +18,6 @@ static const struct capability_name* lookup_capability(register const char *str,
|
|||
#include "cap-to-name.h"
|
||||
|
||||
const char *capability_to_name(int id) {
|
||||
|
||||
if (id < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -94,11 +93,10 @@ int capability_set_to_string_alloc(uint64_t set, char **s) {
|
|||
|
||||
int capability_set_from_string(const char *s, uint64_t *set) {
|
||||
uint64_t val = 0;
|
||||
const char *p;
|
||||
|
||||
assert(set);
|
||||
|
||||
for (p = s;;) {
|
||||
for (const char *p = s;;) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
|
||||
/* verify the capability parser */
|
||||
static void test_cap_list(void) {
|
||||
int i;
|
||||
|
||||
assert_se(!capability_to_name(-1));
|
||||
assert_se(!capability_to_name(capability_list_length()));
|
||||
|
||||
for (i = 0; i < capability_list_length(); i++) {
|
||||
for (int i = 0; i < capability_list_length(); i++) {
|
||||
const char *n;
|
||||
|
||||
assert_se(n = capability_to_name(i));
|
||||
|
@ -35,7 +33,7 @@ static void test_cap_list(void) {
|
|||
assert_se(capability_from_name("64") == -EINVAL);
|
||||
assert_se(capability_from_name("-1") == -EINVAL);
|
||||
|
||||
for (i = 0; i < capability_list_length(); i++) {
|
||||
for (int i = 0; i < capability_list_length(); i++) {
|
||||
_cleanup_cap_free_charp_ char *a = NULL;
|
||||
const char *b;
|
||||
unsigned u;
|
||||
|
|
Loading…
Reference in a new issue