Instead, compute it once outside of the loop in a local variable and
decrement that variable.
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
void DNSName::trimToLabels(unsigned int to)
{
- while(countLabels() > to && chopOff()) {
- ;
+ for (auto nlabels = countLabels(); nlabels > to; --nlabels) {
+ chopOff();
}
}
if (rrsig_labels < fqdn_labels) {
DNSName choppedQname(qname);
- while (choppedQname.countLabels() > rrsig_labels) {
+ for (auto nlabels = fqdn_labels; nlabels > rrsig_labels; --nlabels) {
choppedQname.chopOff();
}
nameToHash = "\x01*" + choppedQname.toDNSStringLC();