From: Miek Gieben Date: Wed, 15 Dec 2004 13:01:18 +0000 (+0000) Subject: moved stuff around - CodingStyle fixes X-Git-Tag: release-0.50~676 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32754eecbf7feb3d8158649766b756c07f960376;p=thirdparty%2Fldns.git moved stuff around - CodingStyle fixes --- diff --git a/Makefile.in b/Makefile.in index 390d6ff3..30ca7d91 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,8 +21,7 @@ LINTFLAGS = +quiet +posixlib -weak -warnposix -unrecog #INSTALL_PROGRAM = $(INSTALL) LIBDNS_SOURCES=rdata.c util.c rr.c packet.c -LIBDNS_HEADERS=rdata.h prototype.h rr.h packet.h util.h \ -error.h +LIBDNS_HEADERS=rdata.h prototype.h rr.h packet.h util.h error.h LIBDNS_OBJECTS=$(LIBDNS_SOURCES:.c=.o) ALL_SOURCES=run-test0.c $(LIBDNS_SOURCES) diff --git a/error.h b/ldns/error.h similarity index 70% rename from error.h rename to ldns/error.h index adb977fa..807d2829 100644 --- a/error.h +++ b/ldns/error.h @@ -18,10 +18,11 @@ enum ldns_enum_status_type { - EEMPTY_LABEL = 1 * __X, - EDDD_OVERFLOW = 2 * __X + LDNS_E_OK = 0, + LDNS_E_EMPTY_LABEL = 1 * __X, + LDNS_E_DDD_OVERFLOW = 2 * __X }; -typedef enum ldns_enum_status_type ldns_t_status; +typedef enum ldns_enum_status_type ldns_status_type; #endif /* _ERROR_H */ diff --git a/rdata.c b/rdata.c index 69feb92a..9d7ed25c 100644 --- a/rdata.c +++ b/rdata.c @@ -13,9 +13,9 @@ #include #include +#include #include "util.h" -#include "error.h" /* Access functions * do this as functions to get type checking @@ -101,24 +101,24 @@ _ldns_rd_field_destroy(t_rdata_field *rd) /** * remove \DDD, \[space] and other escapes from the input * See RFC 1035, section 5.1 - * Return the lenght of the string or a negative error + * Return the length of the string or a negative error * code */ -ldns_t_status -_ldns_octet(char *word) +ldns_status_type +_ldns_octet(char *word, size_t *length) { char *s; char *p; - unsigned int length = 0; + *length = 0; for (s = p = word; *s != '\0'; s++,p++) { switch (*s) { case '.': if (s[1] == '.') { fprintf(stderr,"Empty label"); - return EEMPTY_LABEL; + return LDNS_E_EMPTY_LABEL; } *p = *s; - length++; + *length++; break; case '\\': if ('0' <= s[1] && s[1] <= '9' && @@ -133,15 +133,15 @@ _ldns_octet(char *word) /* this also handles \0 */ s += 3; *p = val; - length++; + *length++; } else { - fprintf(stderr,"ASCII \\DDD overflow"); + return LDNS_E_DDD_OVERFLOW; } } else { /* an espaced character, like \ ? * remove the '\' keep the rest */ *p = *++s; - length++; + *length++; } break; case '\"': @@ -149,19 +149,20 @@ _ldns_octet(char *word) * the string */ *p = *++s; /* skip it */ - length++; + *length++; /* I'm not sure if this is needed in libdns... MG */ if ( *s == '\0' ) { /* ok, it was the last one */ - *p = '\0'; return length; + *p = '\0'; + return LDNS_E_OK; } break; default: *p = *s; - length++; + *length++; break; } } *p = '\0'; - return length; + return LDNS_E_OK; }