chiark / gitweb /
src/: Separate context state into parts for the type itself and its parent.
[adns.git] / src / internal.h
index 58cd15d2fba69ae80e8f09bf99b71580b8cce07a..512a2b11e4e4511b61e946482fe823b7886ac089 100644 (file)
@@ -89,15 +89,6 @@ typedef enum {
 
 /* Shared data structures */
 
-typedef union {
-  adns_status status;
-  char *cp;
-  adns_rrtype type;
-  int i;
-  struct in_addr ia;
-  unsigned long ul;
-} rr_align;
-
 typedef struct {
   int used, avail;
   byte *buf;
@@ -190,10 +181,15 @@ union maxalign {
 typedef struct {
   void *ext;
   void (*callback)(adns_query parent, adns_query child);
+
+  union {
+    adns_rr_addr ptr_addr;
+  } tinfo; /* type-specific state for the query itself: zero-init if you
+           * don't know better. */
+
   union {
-    adns_rr_addr ptr_parent_addr;
     adns_rr_hostaddr *hostaddr;
-  } info;
+  } pinfo; /* state for use by parent's callback function */
 } qcontext;
 
 struct adns__query {