From: Otto Moerbeek Date: Wed, 6 Mar 2024 12:29:57 +0000 (+0100) Subject: Move #define to static const string X-Git-Tag: dnsdist-1.10.0-alpha0~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de7c2e5936710ec5e209780c2a1acb6ee14b3141;p=thirdparty%2Fpdns.git Move #define to static const string --- diff --git a/pdns/fstrm_logger.cc b/pdns/fstrm_logger.cc index 6f31fb1450..7c839e7b19 100644 --- a/pdns/fstrm_logger.cc +++ b/pdns/fstrm_logger.cc @@ -11,10 +11,10 @@ #include "dolog.hh" #endif -#define DNSTAP_CONTENT_TYPE "protobuf:dnstap.Dnstap" - #ifdef HAVE_FSTRM +static const std::string DNSTAP_CONTENT_TYPE = "protobuf:dnstap.Dnstap"; + FrameStreamLogger::FrameStreamLogger(const int family, std::string address, bool connect, const std::unordered_map& options) : d_family(family), d_address(std::move(address)) { @@ -24,7 +24,7 @@ FrameStreamLogger::FrameStreamLogger(const int family, std::string address, bool throw std::runtime_error("FrameStreamLogger: fstrm_writer_options_init failed."); } - auto res = fstrm_writer_options_add_content_type(d_fwopt, DNSTAP_CONTENT_TYPE, sizeof(DNSTAP_CONTENT_TYPE) - 1); + auto res = fstrm_writer_options_add_content_type(d_fwopt, DNSTAP_CONTENT_TYPE.c_str(), DNSTAP_CONTENT_TYPE.size()); if (res != fstrm_res_success) { throw std::runtime_error("FrameStreamLogger: fstrm_writer_options_add_content_type failed: " + std::to_string(res)); }