string-table: Introduce DECLARE_STRING_TABLE_LOOKUP() and friends

Let's introduce these for the following two reasons:
- Using them makes sure the parameter names match between declaration
  and definition (if both use the corresponding macros).
- They make sure developers can't forget the _const_ and _pure_
  attributes for the declarations.

This commit also includes some include sorting fixes
This commit is contained in:
Daan De Meyer
2026-01-02 04:05:45 +09:00
committed by Yu Watanabe
parent daff8ea8bb
commit aec52c1e6e
139 changed files with 351 additions and 589 deletions
+1 -2
View File
@@ -241,8 +241,7 @@ int netdev_generate_hw_addr(NetDev *netdev, Link *parent, const char *name,
bool netdev_needs_reconfigure(NetDev *netdev, NetDevLocalAddressType type);
int link_request_stacked_netdev(Link *link, NetDev *netdev);
const char* netdev_kind_to_string(NetDevKind d) _const_;
NetDevKind netdev_kind_from_string(const char *s) _pure_;
DECLARE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
static inline NetDevCreateType netdev_get_create_type(NetDev *netdev) {
assert(netdev);