summaryrefslogtreecommitdiff
path: root/lookup.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-11-16 09:06:07 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-11-16 09:07:30 +0100
commit3d84a7208988ad641599271d5bfde078c2fc9b4c (patch)
tree8658bae75e587b3569a967bdb1a6c351f3b229b8 /lookup.c
parent04b2adac4e5d460f39454b59ed4f2d3374cb796b (diff)
lookup: Convert __do_lookup_inline to function
Make __do_lookup_inline an inline function and shorten its name to __lookup_inline. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'lookup.c')
-rw-r--r--lookup.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lookup.c b/lookup.c
index a8dfe20..516ca7c 100644
--- a/lookup.c
+++ b/lookup.c
@@ -127,32 +127,32 @@ void lookup_cleanup(enum lookup_type which)
lookup_initialized[which] = false;
}
-#define __do_lookup_inline(id, hash_ptr) \
- ({ \
- struct lookup_entry *entry = lookup_hash(id, hash_ptr); \
- \
- while (entry && id != entry->id) \
- entry = entry->next; \
- \
- (entry && id == entry->id ? entry->str : NULL); \
- })
+static inline char *__lookup_inline(unsigned int id, struct hash_table *tbl)
+{
+ struct lookup_entry *entry = lookup_hash(id, tbl);
+
+ while (entry && id != entry->id)
+ entry = entry->next;
+
+ return (entry && id == entry->id ? entry->str : NULL);
+}
char *lookup_ether_type(unsigned int id)
{
- return __do_lookup_inline(id, &lookup_tables[LT_ETHERTYPES]);
+ return __lookup_inline(id, &lookup_tables[LT_ETHERTYPES]);
}
char *lookup_port_udp(unsigned int id)
{
- return __do_lookup_inline(id, &lookup_tables[LT_PORTS_UDP]);
+ return __lookup_inline(id, &lookup_tables[LT_PORTS_UDP]);
}
char *lookup_port_tcp(unsigned int id)
{
- return __do_lookup_inline(id, &lookup_tables[LT_PORTS_TCP]);
+ return __lookup_inline(id, &lookup_tables[LT_PORTS_TCP]);
}
char *lookup_vendor(unsigned int id)
{
- return __do_lookup_inline(id, &lookup_tables[LT_OUI]);
+ return __lookup_inline(id, &lookup_tables[LT_OUI]);
}