]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
does not compile - ik zie het ff niet meer...
authorMiek Gieben <miekg@NLnetLabs.nl>
Mon, 13 Dec 2004 12:37:38 +0000 (12:37 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Mon, 13 Dec 2004 12:37:38 +0000 (12:37 +0000)
Makefile.in
packet.c
prototype.h
rdata.c
rr.c
run-test0.c
util.c

index d869db76710af26620a885c3070e5d9b92223d1d..5f40fb04994ed6157453fbc1ad4476ada990e7ec 100644 (file)
@@ -18,7 +18,7 @@ LIBS          = @LIBS@
 #INSTALL_PROGRAM = $(INSTALL)
 
 LIBDNS_SOURCES=rdata.c util.c rr.c packet.c
-LIBDNS_HEADERS=rdata.h prototype.h rr.h packet.h
+LIBDNS_HEADERS=rdata.h prototype.h rr.h packet.h util.h
 LIBDNS_OBJECTS=$(LIBDNS_SOURCES:.c=.o)
 
 ALL_SOURCES=run-test0.c $(LIBDNS_SOURCES)
index d67a8361c02df12631eccb512099bb9d1b1265ed..3b246215ce2b151989da55482ff1cc9f6d67d2d0 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -16,6 +16,7 @@
 #include "rr.h"
 #include "prototype.h"
 #include "packet.h"
+#include "util.h"
 
 /* Access functions 
  * do this as functions to get type checking
@@ -200,11 +201,11 @@ t_packet *
 dns_packet_new()
 {
        t_packet *packet;
-       packet = xmalloc(sizeof(t_packet));
+       MALLOC(packet, t_packet);
        if (!packet) 
                return NULL;
 
-       packet->header = xmalloc(sizeof(t_header));
+       MALLOC(packet_header, t_header);
        if (!packet->header)
                return NULL;
        
index adf2f8d55a4d5e9082547e85e12fadcab3738805..6d5e1bca374a300bb986b2813acc2f6334c1c440 100644 (file)
 #else
 #define _PROTOTYPE_H
 
-/* util.c */
-void   *xmalloc(size_t);
-void   *xrealloc(void *, size_t);
-void   xprintf_rd_field(t_rdata_field *);
-void   xprintf_rr(t_rr *);
+/* empty for now */
 
 #endif /* _PROTOTYPE_H */
diff --git a/rdata.c b/rdata.c
index b8c3a120b6232e893b8db181f966dc3785fdeebc..c893075cf5e161451bddc0760f88e006ab754de0 100644 (file)
--- a/rdata.c
+++ b/rdata.c
@@ -14,6 +14,7 @@
 
 #include "rdata.h"
 #include "rr.h"
+#include "util.h"
 #include "prototype.h"
 
 /* Access functions 
@@ -55,7 +56,7 @@ rd_field_set_type(t_rdata_field *rd, t_rd_type t)
 void
 rd_field_set_data(t_rdata_field *rd, uint8_t *d, uint16_t s)
 {
-       rd->_data = xmalloc(s);
+       XMALLOC(rd->_data, uint8_t, s);
        memcpy(rd->_data, d, s);
 }
 
@@ -67,8 +68,7 @@ t_rdata_field *
 rd_field_new(uint16_t s, t_rd_type t, uint8_t *d)
 {
        t_rdata_field *rd;
-       rd = xmalloc(sizeof(t_rdata_field));
-
+       MALLOC(rd, t_rdata_field);
        if (!rd)
                return NULL;
 
@@ -90,9 +90,9 @@ t_rdata_field *
 rd_field_new_frm_string(t_rd_type t, char *s)
 {
        t_rdata_field *new;
-       new = xmalloc(sizeof(t_rdata_field));
+       new = malloc(1 * sizeof t_rdata_field ) ;
 
-       if (NULL == new)
+       if (!new)
                return NULL;
 
        rd_field_set_size(new, (uint16_t)strlen(s));
diff --git a/rr.c b/rr.c
index 5c24028112d034dd50629869417b27121b8cab78..ccf36864763a40e0b9936c8f8c938c8d846bb58e 100644 (file)
--- a/rr.c
+++ b/rr.c
@@ -15,6 +15,7 @@
 #include "rdata.h"
 #include "rr.h"
 #include "prototype.h"
+#include "util.h"
 
 /**
  * create a new rr structure.
@@ -23,8 +24,7 @@ t_rr *
 rr_new(void)
 {
        t_rr *rr;
-        rr = xmalloc(sizeof(t_rr));
-
+       MALLOC(rr, t_rr);
         if (!rr)
                 return NULL;
 
index d0355012450b196e55f75f23ad674090481d752e..26c68048ca5308bdab5a02f6d83f9245a92da8ea 100644 (file)
@@ -9,6 +9,7 @@
 #include "rr.h"
 #include "packet.h"
 #include "prototype.h"
+#include "util.h"
 
 int
 main(void)
@@ -27,7 +28,7 @@ main(void)
 
        xprintf_rr(rr);
 
-       wire = xmalloc(100);
+       XMALLOC(wire, uint8_t, 100);
        wire[0] = 0xc2;
        wire[1] = 0xb4;
        wire[2] = 0x81;
diff --git a/util.c b/util.c
index 5830a816c3ca7975459617d72547c58cc659f07a..11992cddae798c61fe28578fdc2c8694c6bf8605 100644 (file)
--- a/util.c
+++ b/util.c
 #include "rdata.h"
 #include "rr.h"
 
-void *
-xmalloc(size_t s)
-{
-       void *p;
-       p = (void*)malloc(s);
-       return p;
-}
-
-void *
-xrealloc(void *p, size_t s)
-{
-       p = (void*)realloc(p, s);
-       return p;
-}
-
 /* put this here tmp. for debugging */
 void
 xprintf_rd_field(t_rdata_field *rd)