return static_cast<uint64_t>(std::round(dnsQuestion->dq->ids.queryRealTime.udiff()));
}
-// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
-static bool checkDNSQuestionType(const char functionName[], const dnsdist_ffi_dnsquestion_t* dnsQuestion)
+static bool checkDNSQuestionType(const std::string_view& functionName, const dnsdist_ffi_dnsquestion_t* dnsQuestion)
{
if (dnsQuestion->objectType != dnsdist::lua::ffi::ObjectType::Question) {
VERBOSESLOG(infolog("Error: calling FFI function %s with a wrong type", functionName),
size_t dnsdist_ffi_dnsquestion_get_tag_array(dnsdist_ffi_dnsquestion_t* dnsQuestion, const dnsdist_ffi_tag_t** out)
{
- if (dnsQuestion == nullptr || dnsQuestion->dq == nullptr || dnsQuestion->dq->ids.qTag == nullptr || dnsQuestion->dq->ids.qTag->size() == 0) {
+ if (dnsQuestion == nullptr || dnsQuestion->dq == nullptr || dnsQuestion->dq->ids.qTag == nullptr || dnsQuestion->dq->ids.qTag->empty()) {
return 0;
}
if (!checkDNSQuestionType(__func__, dnsQuestion)) {
}
auto domains = pool.packetCache->getDomainsContainingRecords(caAddr);
- if (domains.size() == 0) {
+ if (domains.empty()) {
return 0;
}
}
auto addresses = pool.packetCache->getRecordsForDomain(name);
- if (addresses.size() == 0) {
+ if (addresses.empty()) {
return 0;
}
return;
}
try {
- parameters->parameters.ipv4hints.emplace_back(ComboAddress(std::string(value, valueLen)));
+ parameters->parameters.ipv4hints.emplace_back(std::string(value, valueLen));
}
catch (const std::exception& exp) {
SLOG(errlog("Exception in dnsdist_ffi_svc_record_parameters_add_ipv4_hint: %s", exp.what()),
return;
}
try {
- parameters->parameters.ipv6hints.emplace_back(ComboAddress(std::string(value, valueLen)));
+ parameters->parameters.ipv6hints.emplace_back(std::string(value, valueLen));
}
catch (const std::exception& exp) {
SLOG(errlog("Exception in dnsdist_ffi_svc_record_parameters_add_ipv6_hint: %s", exp.what()),