1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 20:44:26 +01:00

Improve DNS class performance slightly

This commit is contained in:
Matias Fontanini
2017-05-13 19:44:57 -07:00
parent 4763486523
commit 348371e43c
2 changed files with 43 additions and 12 deletions

View File

@@ -183,8 +183,13 @@ public:
* \param tp The query type.
* \param cl The query class.
*/
#if TINS_IS_CXX11
query(std::string nm, QueryType tp, QueryClass cl)
: name_(std::move(nm)), type_(tp), qclass_(cl) {}
#else
query(const std::string& nm, QueryType tp, QueryClass cl)
: name_(nm), type_(tp), qclass_(cl) {}
#endif
/**
* \brief Default constructs this Query.
@@ -448,6 +453,16 @@ public:
* \param rclass The class of this record.
* \param ttl The time-to-live of this record.
*/
#if TINS_IS_CXX11
resource(std::string dname,
std::string data,
uint16_t type,
uint16_t rclass,
uint32_t ttl,
uint16_t preference = 0)
: dname_(std::move(dname)), data_(std::move(data)), type_(type),
qclass_(rclass), ttl_(ttl), preference_(preference) {}
#else
resource(const std::string& dname,
const std::string& data,
uint16_t type,
@@ -456,6 +471,7 @@ public:
uint16_t preference = 0)
: dname_(dname), data_(data), type_(type), qclass_(rclass),
ttl_(ttl), preference_(preference) {}
#endif
resource() : type_(), qclass_(), ttl_(), preference_() {}