From: Vladimír Čunát Date: Mon, 26 Sep 2022 10:31:25 +0000 (+0200) Subject: daemon/session2 nit: use `const char *` for names X-Git-Tag: v6.0.2~42^2~46 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d26843c66d3953d9be86aa791b636f0c889d8b8c;p=thirdparty%2Fknot-resolver.git daemon/session2 nit: use `const char *` for names That also matches the real type of those string literals. --- diff --git a/daemon/session2.c b/daemon/session2.c index 8546fb962..7a5ce454d 100644 --- a/daemon/session2.c +++ b/daemon/session2.c @@ -57,7 +57,7 @@ static enum protolayer_protocol protolayer_grp_doh[] = { }; -char *protolayer_protocol_names[PROTOLAYER_PROTOCOL_COUNT] = { +const char *protolayer_protocol_names[PROTOLAYER_PROTOCOL_COUNT] = { [PROTOLAYER_NULL] = "(null)", #define XX(cid) [PROTOLAYER_##cid] = #cid, PROTOLAYER_PROTOCOL_MAP(XX) @@ -79,7 +79,7 @@ static enum protolayer_protocol *protolayer_grps[PROTOLAYER_GRP_COUNT] = { }; /** Human-readable names for protocol layer groups. */ -char *protolayer_grp_names[PROTOLAYER_GRP_COUNT] = { +const char *protolayer_grp_names[PROTOLAYER_GRP_COUNT] = { [PROTOLAYER_GRP_NULL] = "(null)", #define XX(cid, vid, name, alpn) [PROTOLAYER_GRP_##cid] = name, PROTOLAYER_GRP_MAP(XX) @@ -87,7 +87,7 @@ char *protolayer_grp_names[PROTOLAYER_GRP_COUNT] = { }; /** Human-readable names for events. */ -char *protolayer_event_names[PROTOLAYER_EVENT_COUNT] = { +const char *protolayer_event_names[PROTOLAYER_EVENT_COUNT] = { [PROTOLAYER_EVENT_NULL] = "(null)", #define XX(cid) [PROTOLAYER_EVENT_##cid] = #cid, PROTOLAYER_EVENT_MAP(XX) @@ -95,7 +95,7 @@ char *protolayer_event_names[PROTOLAYER_EVENT_COUNT] = { }; /** Human-readable names for payloads. */ -char *protolayer_payload_names[PROTOLAYER_PAYLOAD_COUNT] = { +const char *protolayer_payload_names[PROTOLAYER_PAYLOAD_COUNT] = { [PROTOLAYER_PAYLOAD_NULL] = "(null)", #define XX(cid, name) [PROTOLAYER_PAYLOAD_##cid] = name, PROTOLAYER_PAYLOAD_MAP(XX) diff --git a/daemon/session2.h b/daemon/session2.h index 7516ffe39..c230d2929 100644 --- a/daemon/session2.h +++ b/daemon/session2.h @@ -107,7 +107,7 @@ enum protolayer_protocol { /** Maps protocol layer type IDs to string names. * E.g. PROTOLAYER_HTTP has name 'HTTP'. */ -extern char *protolayer_protocol_names[]; +extern const char *protolayer_protocol_names[]; /** Protocol layer groups. Each of these represents a sequence of layers in the * unwrap direction (wrap direction being the opposite). The sequence dictates @@ -139,7 +139,7 @@ enum protolayer_grp { /** Maps protocol layer group IDs to human-readable descriptions. * E.g. PROTOLAYER_GRP_DOH has description 'DNS-over-HTTPS'. */ -extern char *protolayer_grp_names[]; +extern const char *protolayer_grp_names[]; /** Flow control indicators for protocol layer `wrap` and `unwrap` callbacks. * Use via `protolayer_continue`, `protolayer_break`, and `protolayer_push` @@ -218,7 +218,7 @@ enum protolayer_event_type { PROTOLAYER_EVENT_COUNT }; -extern char *protolayer_event_names[]; +extern const char *protolayer_event_names[]; /** Payload types. @@ -241,7 +241,7 @@ enum protolayer_payload_type { PROTOLAYER_PAYLOAD_COUNT }; -extern char *protolayer_payload_names[]; +extern const char *protolayer_payload_names[]; /** Data processed by the sequence of layers. All pointed-to memory is always * owned by its creator. It is also the layer (group) implementor's