summaryrefslogtreecommitdiff
path: root/lib/fddi.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-11-20 19:27:14 -0500
committerMike Frysinger <vapier@gentoo.org>2011-11-20 19:46:38 -0500
commit46cd57a736c30bafd41406781e7b1c6532e6a97d (patch)
tree8a760a169b7fadaec8be60d4067c7dc90d3b4e76 /lib/fddi.c
parent243cd05e7ac857f64648639e970a8c0d28dc0f2e (diff)
downloadnet-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.tar.gz
net-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.tar.bz2
net-tools-46cd57a736c30bafd41406781e7b1c6532e6a97d.zip
fix up unused variable warnings
Some of these are unused, so drop them. Others are only used in debug code, so refactor those so things are always compiled. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib/fddi.c')
-rw-r--r--lib/fddi.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/lib/fddi.c b/lib/fddi.c
index 75adddd..750cc2d 100644
--- a/lib/fddi.c
+++ b/lib/fddi.c
@@ -57,6 +57,11 @@ static const char *pr_fddi(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an FDDI address and convert to binary. */
static int in_fddi(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -95,9 +99,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -106,28 +109,21 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == FDDI_K_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == FDDI_K_ALEN)
fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == FDDI_K_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
return (0);
}