From: Miek Gieben Date: Tue, 21 Dec 2004 14:06:17 +0000 (+0000) Subject: get it to compile on linux first X-Git-Tag: release-0.50~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b79f34935aceadd45532a5deff1bc3e12e56aa3f;p=thirdparty%2Fldns.git get it to compile on linux first --- diff --git a/Makefile.in b/Makefile.in index ec082a90..5a7ae381 100644 --- a/Makefile.in +++ b/Makefile.in @@ -28,6 +28,7 @@ LIBDNS_HEADERS = ldns/error.h \ ldns/rr.h \ ldns/wire2host.h \ ldns/host2str.h \ + ldns/str2host.h \ util.h \ buffer.h LIBDNS_OBJECTS = $(LIBDNS_SOURCES:.c=.o) diff --git a/ldns/str2host.h b/ldns/str2host.h index e5527fa7..05645a2f 100644 --- a/ldns/str2host.h +++ b/ldns/str2host.h @@ -10,8 +10,6 @@ #include #include - ldns_status zparser_conv_short(ldns_rdf *, const char *); - #endif diff --git a/str2host.c b/str2host.c index 4503b5a6..5f17aad1 100644 --- a/str2host.c +++ b/str2host.c @@ -12,8 +12,9 @@ */ #include +#include -#include +#include "util.h" #include #include @@ -25,13 +26,18 @@ ldns_status zparser_conv_short(ldns_rdf *rd, const char *shortstr) { - char *end; /* Used to parse longs, ttls, etc. */ - rd->_size = 2; - rd->_data = (uint8_t*)htons((uint16_t)strtol(shortstr, &end, 0)); - + char *end = NULL; /* Used to parse longs, ttls, etc. */ + + uint16_t *r; + + r = MALLOC(uint16_t); + + *r = htons((uint16_t)strtol(shortstr, &end, 0)); + if(*end != 0) { return LDNS_STATUS_INT_EXP; } else { + rd = ldns_rdf_new(2, LDNS_RDF_TYPE_INT16, (uint8_t*)r); return LDNS_STATUS_OK; } }