summaryrefslogtreecommitdiffstats
path: root/lib/icmp.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-05-31 19:38:00 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-05-31 19:38:00 +0200
commit3f83fda46c14e47392ce3bb4d7aef5780a80ac78 (patch)
tree27283f40fe6410a06649095b24fd35039f44929b /lib/icmp.c
parent418a3a4f4d4e38abd1d691f81f2445590f02ecaf (diff)
Whitespace and coding fixes detected by checkpatch.pl
Diffstat (limited to 'lib/icmp.c')
-rw-r--r--lib/icmp.c20
1 files changed, 11 insertions, 9 deletions
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 <libipset/utils.h> /* 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;
}