Skip to content

Commit 1fae4f5

Browse files
eckiBernd Eckenfels
authored andcommitted
Unify DEBUG in ib.c
1 parent c4a0b2d commit 1fae4f5

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

lib/ib.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/*
2-
* lib/ib.c This file contains an implementation of the "Infiniband"
2+
* lib/ib.c This file contains an implementation of the "Infiniband"
33
* support functions.
44
*
5-
* Version: $Id: ib.c,v 1.1 2008/10/03 01:52:03 ecki Exp $
6-
*
75
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
86
* Copyright 1993 MicroWalt Corporation
97
* Tom Duffy <tduffy@sun.com>
@@ -56,26 +54,23 @@ static const char *pr_ib(const char *ptr)
5654
return (buff);
5755
}
5856

59-
#ifdef DEBUG
60-
#define _DEBUG 1
61-
#else
62-
#define _DEBUG 0
63-
#endif
6457

6558
/* Input an Infiniband address and convert to binary. */
6659
static int in_ib(char *bufp, struct sockaddr_storage *sasp)
6760
{
6861
struct sockaddr *sap = (struct sockaddr *)sasp;
6962
char *ptr;
70-
char c, *orig;
63+
char c;
7164
int i;
7265
unsigned val;
7366

7467
sap->sa_family = ib_hwtype.type;
7568
ptr = sap->sa_data;
7669

7770
i = 0;
78-
orig = bufp;
71+
#ifdef DEBUG
72+
char *orig = bufp;
73+
#endif
7974
while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) {
8075
val = 0;
8176
c = *bufp++;
@@ -86,8 +81,9 @@ static int in_ib(char *bufp, struct sockaddr_storage *sasp)
8681
else if (c >= 'A' && c <= 'F')
8782
val = c - 'A' + 10;
8883
else {
89-
if (_DEBUG)
84+
#ifdef DEBUG
9085
fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
86+
#endif
9187
errno = EINVAL;
9288
return (-1);
9389
}
@@ -115,13 +111,11 @@ static int in_ib(char *bufp, struct sockaddr_storage *sasp)
115111

116112
/* We might get a semicolon here - not required. */
117113
if (*bufp == ':') {
118-
if (i == INFINIBAND_ALEN) {
119114
#ifdef DEBUG
120-
fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"),
121-
orig)
115+
if (i == INFINIBAND_ALEN) {
116+
fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"), orig);
117+
}
122118
#endif
123-
; /* nothing */
124-
}
125119
bufp++;
126120
}
127121
}

0 commit comments

Comments
 (0)