mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-24 02:03:54 +03:00
busctl: use size_t for set size
Also reduce the scope of variables. (cherry picked from commit bc1f1eba776434f84f082bf4935b736c94dbb0f1)
This commit is contained in:
parent
802fded9a5
commit
00977a8e74
@ -357,9 +357,6 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
|
||||
}
|
||||
|
||||
static void print_subtree(const char *prefix, const char *path, char **l) {
|
||||
const char *vertical, *space;
|
||||
char **n;
|
||||
|
||||
/* We assume the list is sorted. Let's first skip over the
|
||||
* entry we are looking at. */
|
||||
for (;;) {
|
||||
@ -372,11 +369,13 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
|
||||
l++;
|
||||
}
|
||||
|
||||
vertical = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_VERTICAL));
|
||||
space = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_SPACE));
|
||||
const char
|
||||
*vertical = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_VERTICAL)),
|
||||
*space = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_SPACE));
|
||||
|
||||
for (;;) {
|
||||
bool has_more = false;
|
||||
char **n;
|
||||
|
||||
if (!*l || !path_startswith(*l, path))
|
||||
break;
|
||||
@ -961,8 +960,8 @@ static int introspect(int argc, char **argv, void *userdata) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply_xml = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(member_set_freep) Set *members = NULL;
|
||||
unsigned name_width, type_width, signature_width, result_width, j, k = 0;
|
||||
Member *m, **sorted = NULL;
|
||||
unsigned name_width, type_width, signature_width, result_width;
|
||||
Member *m;
|
||||
const char *xml;
|
||||
int r;
|
||||
|
||||
@ -1086,7 +1085,8 @@ static int introspect(int argc, char **argv, void *userdata) {
|
||||
signature_width = strlen("SIGNATURE");
|
||||
result_width = strlen("RESULT/VALUE");
|
||||
|
||||
sorted = newa(Member*, set_size(members));
|
||||
Member **sorted = newa(Member*, set_size(members));
|
||||
size_t k = 0;
|
||||
|
||||
SET_FOREACH(m, members) {
|
||||
if (argv[3] && !streq(argv[3], m->interface))
|
||||
@ -1123,7 +1123,7 @@ static int introspect(int argc, char **argv, void *userdata) {
|
||||
(int) result_width, "RESULT/VALUE",
|
||||
"FLAGS");
|
||||
|
||||
for (j = 0; j < k; j++) {
|
||||
for (size_t j = 0; j < k; j++) {
|
||||
_cleanup_free_ char *ellipsized = NULL;
|
||||
const char *rv;
|
||||
bool is_interface;
|
||||
|
Loading…
x
Reference in New Issue
Block a user