]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
moved stuff around - CodingStyle fixes
authorMiek Gieben <miekg@NLnetLabs.nl>
Wed, 15 Dec 2004 13:01:18 +0000 (13:01 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Wed, 15 Dec 2004 13:01:18 +0000 (13:01 +0000)
Makefile.in
ldns/error.h [moved from error.h with 70% similarity]
rdata.c

index 390d6ff368959692d5763f47c6577ad490e0bee0..30ca7d91c1d2e792c5e1335a878230579302f2c3 100644 (file)
@@ -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)
similarity index 70%
rename from error.h
rename to ldns/error.h
index adb977fad1a0e5fa8c1438567ca7b857a50c8fcf..807d282917fd54696df8882896711c7e77ee5d82 100644 (file)
--- a/error.h
 
 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 69feb92a3158e836bc0dc3eee31ca7fb51f1e250..9d7ed25c2c9fd6bad089c8e79e35139b9f2868b9 100644 (file)
--- a/rdata.c
+++ b/rdata.c
@@ -13,9 +13,9 @@
 #include <config.h>
 
 #include <ldns/rdata.h>
+#include <ldns/error.h>
 
 #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 \<space> ? 
                     * 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;
 }