summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-07-15 16:26:52 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-07-15 16:26:52 +0000
commit182180131a287ce1ad671222d8a1708ebd145bae (patch)
treef94eac8856644544dd735060dd050262cbf39be4
parentb31cc7f69bc28a7cc497f38da511ab512d885c8d (diff)
downloadldetect-182180131a287ce1ad671222d8a1708ebd145bae.tar
ldetect-182180131a287ce1ad671222d8a1708ebd145bae.tar.gz
ldetect-182180131a287ce1ad671222d8a1708ebd145bae.tar.bz2
ldetect-182180131a287ce1ad671222d8a1708ebd145bae.tar.xz
ldetect-182180131a287ce1ad671222d8a1708ebd145bae.zip
compacificazion
-rw-r--r--lspcidrake.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/lspcidrake.c b/lspcidrake.c
index 72b6a44..fccecb3 100644
--- a/lspcidrake.c
+++ b/lspcidrake.c
@@ -4,12 +4,10 @@
static int verboze = 0;
-typedef const char *(f_t)(unsigned long );
-
-static void printit(struct pciusb_entries *entries, f_t find_class) {
+static void printit(struct pciusb_entries entries, const char *(find_class)(unsigned long )) {
unsigned int i;
- for (i = 0; i < entries->nb; i++) {
- struct pciusb_entry *e = &entries->entries[i];
+ for (i = 0; i < entries.nb; i++) {
+ struct pciusb_entry *e = &entries.entries[i];
printf("%-16s: ", e->module ? e->module : "unknown");
if (e->text)
printf(e->text);
@@ -26,13 +24,14 @@ static void printit(struct pciusb_entries *entries, f_t find_class) {
}
printf("\n");
}
+ pciusb_free(&entries);
+
}
int main(int argc, char **argv) {
char ** ptr = argv;
int full_probe = 0;
- struct pciusb_entries entries;
while (ptr && *ptr) {
if (!strcmp(*ptr, "-h") || !strcmp(*ptr, "--help")) {
@@ -48,12 +47,7 @@ int main(int argc, char **argv) {
ptr++;
}
- entries = pci_probe(full_probe);
- printit(&entries, pci_class2text);
- pciusb_free(&entries);
-
- entries = usb_probe();
- printit(&entries, usb_class2text);
- pciusb_free(&entries);
+ printit(pci_probe(full_probe), pci_class2text);
+ printit(usb_probe(), usb_class2text);
return 0;
}