# HG changeset patch # User Rob Landley # Date 1392570563 21600 # Node ID 4f080cdb2f6eee1cfeb871a9a7d35243ba4a441d # Parent 9adf66c7dd4eb3b3b56f7f3ded2a65a32452027f Various cleanups found by Tom Sparrow's static analysis. diff -r 9adf66c7dd4e -r 4f080cdb2f6e lib/lib.c --- a/lib/lib.c Thu Feb 13 06:45:35 2014 -0600 +++ b/lib/lib.c Sun Feb 16 11:09:23 2014 -0600 @@ -81,7 +81,7 @@ { size_t count = 0; while (countnext; } + + return 0; } diff -r 9adf66c7dd4e -r 4f080cdb2f6e scripts/mkflags.c --- a/scripts/mkflags.c Thu Feb 13 06:45:35 2014 -0600 +++ b/scripts/mkflags.c Sun Feb 16 11:09:23 2014 -0600 @@ -72,7 +72,6 @@ int main(int argc, char *argv[]) { char command[256], flags[1023], allflags[1024]; - unsigned bit; for (;;) { struct flag *flist, *aflist, *offlist; diff -r 9adf66c7dd4e -r 4f080cdb2f6e toys/other/acpi.c --- a/toys/other/acpi.c Thu Feb 13 06:45:35 2014 -0600 +++ b/toys/other/acpi.c Sun Feb 16 11:09:23 2014 -0600 @@ -40,7 +40,7 @@ int acpi_callback(struct dirtree *tree) { - int dfd; + int dfd, fd, len, on; errno = 0; @@ -50,8 +50,6 @@ return DIRTREE_RECURSE | DIRTREE_SYMFOLLOW; if (0 <= (dfd = open(dirtree_path(tree, NULL), O_RDONLY))) { - int fd, len; - if ((fd = openat(dfd, "type", O_RDONLY)) < 0) goto done; len = readall(fd, toybuf, sizeof(toybuf)); close(fd); @@ -71,14 +69,13 @@ if (cap >= 0) printf("Battery %d: %d%%\n", TT.bat++, cap); } } else if (toys.optflags & FLAG_a) { - int on; - if ((on = read_int_at(dfd, "online")) >= 0) printf("Adapter %d: %s-line\n", TT.ac++, (on ? "on" : "off")); } done: close(dfd); } + return 0; } diff -r 9adf66c7dd4e -r 4f080cdb2f6e toys/other/ifconfig.c --- a/toys/other/ifconfig.c Thu Feb 13 06:45:35 2014 -0600 +++ b/toys/other/ifconfig.c Sun Feb 16 11:09:23 2014 -0600 @@ -56,13 +56,6 @@ int sockfd; ) -//for ipv6 add/del -struct ifreq_inet6 { - struct in6_addr ifrinte6_addr; - uint32_t ifrinet6_prefixlen; - int ifrinet6_ifindex; -}; - // Convert hostname to binary address for AF_INET or AF_INET6 // return /prefix (or range max if none) int get_addrinfo(char *host, sa_family_t af, void *addr) diff -r 9adf66c7dd4e -r 4f080cdb2f6e toys/other/pmap.c --- a/toys/other/pmap.c Thu Feb 13 06:45:35 2014 -0600 +++ b/toys/other/pmap.c Sun Feb 16 11:09:23 2014 -0600 @@ -34,7 +34,7 @@ size_t len; long long start, end, pss, tpss = 0, dirty, tdirty = 0, swap, tswap = 0, total = 0; - int count, xx = 0; + int xx = 0; snprintf(toybuf, sizeof(toybuf), "/proc/%u/cmdline", pid); line = readfile(toybuf, 0, 0); @@ -57,7 +57,7 @@ // Loop through mappings for (;;) { - int off; + int off, count; line = 0; if (0 >= getline(&line, &len, fp)) break;