Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsmod: Simplify code #271

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions tools/lsmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,15 @@
int use_count = kmod_module_get_refcnt(mod);
long size = kmod_module_get_size(mod);
struct kmod_list *holders, *hitr;
int first = 1;
int sep = ' ';

Check warning on line 104 in tools/lsmod.c

View check run for this annotation

Codecov / codecov/patch

tools/lsmod.c#L104

Added line #L104 was not covered by tests

printf("%-19s %8ld %d", name, size, use_count);
holders = kmod_module_get_holders(mod);
kmod_list_foreach(hitr, holders) {
struct kmod_module *hm = kmod_module_get_module(hitr);

if (!first) {
putchar(',');
} else {
putchar(' ');
first = 0;
}
putchar(sep);
sep = ',';

Check warning on line 112 in tools/lsmod.c

View check run for this annotation

Codecov / codecov/patch

tools/lsmod.c#L111-L112

Added lines #L111 - L112 were not covered by tests

fputs(kmod_module_get_name(hm), stdout);
kmod_module_unref(hm);
Expand Down
Loading