mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Move helper functions to common header file.
This commit is contained in:
committed by
Simon Kelley
parent
458824dcb4
commit
4c70046d93
@@ -117,3 +117,20 @@ struct dns_header {
|
|||||||
(cp) += 4; \
|
(cp) += 4; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CHECKED_GETCHAR(var, ptr, len) do { \
|
||||||
|
if ((len) < 1) return 0; \
|
||||||
|
var = *ptr++; \
|
||||||
|
(len) -= 1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CHECKED_GETSHORT(var, ptr, len) do { \
|
||||||
|
if ((len) < 2) return 0; \
|
||||||
|
GETSHORT(var, ptr); \
|
||||||
|
(len) -= 2; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CHECKED_GETLONG(var, ptr, len) do { \
|
||||||
|
if ((len) < 4) return 0; \
|
||||||
|
GETLONG(var, ptr); \
|
||||||
|
(len) -= 4; \
|
||||||
|
} while (0)
|
||||||
|
|||||||
19
src/dnssec.c
19
src/dnssec.c
@@ -3,25 +3,6 @@
|
|||||||
#include "dnssec-crypto.h"
|
#include "dnssec-crypto.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define CHECKED_GETCHAR(var, ptr, len) do { \
|
|
||||||
if ((len) < 1) return 0; \
|
|
||||||
var = *ptr++; \
|
|
||||||
(len) -= 1; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define CHECKED_GETSHORT(var, ptr, len) do { \
|
|
||||||
if ((len) < 2) return 0; \
|
|
||||||
GETSHORT(var, ptr); \
|
|
||||||
(len) -= 2; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define CHECKED_GETLONG(var, ptr, len) do { \
|
|
||||||
if ((len) < 4) return 0; \
|
|
||||||
GETLONG(var, ptr); \
|
|
||||||
(len) -= 4; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
|
||||||
#define SERIAL_UNDEF -100
|
#define SERIAL_UNDEF -100
|
||||||
#define SERIAL_EQ 0
|
#define SERIAL_EQ 0
|
||||||
#define SERIAL_LT -1
|
#define SERIAL_LT -1
|
||||||
|
|||||||
Reference in New Issue
Block a user