tNo need for goto - spoon - dwm status utility (2f30 fork) | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit ec1d812d83bef0d5206975281eea382bcf1f4224 | |
parent 8daa0a03a61de62d8c8d702763a415b1ab7228ea | |
Author: sin <[email protected]> | |
Date: Sat, 16 Sep 2017 19:27:34 +0100 | |
No need for goto | |
Diffstat: | |
M netspeed.c | 10 ++++------ | |
1 file changed, 4 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/netspeed.c b/netspeed.c | |
t@@ -102,7 +102,8 @@ netspeedread(void *arg, char *buf, size_t len) | |
} | |
if (fscanf(fp, "%llu", &rxbytes) != 1) { | |
warn("fscanf %s", path); | |
- goto err; | |
+ fclose(fp); | |
+ return -1; | |
} | |
fclose(fp); | |
(void)snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/tx_by… | |
t@@ -112,15 +113,12 @@ netspeedread(void *arg, char *buf, size_t len) | |
} | |
if (fscanf(fp, "%llu", &txbytes) != 1) { | |
warn("fscanf %s", path); | |
- goto err; | |
+ fclose(fp); | |
+ return -1; | |
} | |
fclose(fp); | |
updatenetspeed(buf, len, rxbytes, txbytes); | |
return 0; | |
- | |
-err: | |
- fclose(fp); | |
- return -1; | |
} | |
#endif |