/* Skip current terminal character (and accept domain names ending it ".") */
if (*terminal == 0)
- terminal--;
+ terminal = PTR_SUB1(terminal, name);
if (terminal >= name && *terminal == '.')
- terminal--;
+ terminal = PTR_SUB1(terminal, name);
/* Point name to the last label, and terminal to the preceding terminal symbol (or make it a NULL pointer) */
- for (;;) {
- if (terminal < name) {
- /* Reached the first label, so indicate that there are no more */
- terminal = NULL;
- break;
- }
-
+ while (terminal) {
/* Find the start of the last label */
if (*terminal == '.') {
const char *y;
unsigned slashes = 0;
- for (y = terminal - 1; y >= name && *y == '\\'; y--)
+ for (y = PTR_SUB1(terminal, name); y && *y == '\\'; y = PTR_SUB1(y, name))
slashes++;
if (slashes % 2 == 0) {
}
}
- terminal--;
+ terminal = PTR_SUB1(terminal, name);
}
r = dns_label_unescape(&name, dest, sz, 0);