From 3f83fda46c14e47392ce3bb4d7aef5780a80ac78 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 31 May 2011 19:38:00 +0200 Subject: Whitespace and coding fixes detected by checkpatch.pl --- lib/icmp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/icmp.c') diff --git a/lib/icmp.c b/lib/icmp.c index c749272..c50be7e 100644 --- a/lib/icmp.c +++ b/lib/icmp.c @@ -1,7 +1,7 @@ /* Copyright 2007-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include /* STRNEQ */ @@ -49,19 +49,20 @@ static const struct icmp_names icmp_typecodes[] = { { "address-mask-reply", 18, 0 }, }; -const char * id_to_icmp(uint8_t id) +const char *id_to_icmp(uint8_t id) { return id < ARRAY_SIZE(icmp_typecodes) ? icmp_typecodes[id].name : NULL; } -const char * icmp_to_name(uint8_t type, uint8_t code) +const char *icmp_to_name(uint8_t type, uint8_t code) { unsigned int i; - + for (i = 0; i < ARRAY_SIZE(icmp_typecodes); i++) - if (icmp_typecodes[i].type == type && icmp_typecodes[i].code == code) + if (icmp_typecodes[i].type == type && + icmp_typecodes[i].code == code) return icmp_typecodes[i].name; - + return NULL; } @@ -71,9 +72,10 @@ int name_to_icmp(const char *str, uint16_t *typecode) for (i = 0; i < ARRAY_SIZE(icmp_typecodes); i++) if (STRNCASEQ(icmp_typecodes[i].name, str, strlen(str))) { - *typecode = (icmp_typecodes[i].type << 8) | icmp_typecodes[i].code; + *typecode = (icmp_typecodes[i].type << 8) | + icmp_typecodes[i].code; return 0; } - + return -1; } -- cgit v1.2.3