From: Wouter Wijngaards Date: Thu, 12 Jan 2006 11:08:22 +0000 (+0000) Subject: Woo! First commit. Made lint happy. Now in lint checks mode. X-Git-Tag: release-1.1.0~428 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75adcd86b2ed9987a7f70c9780f5416105dfbe41;p=thirdparty%2Fldns.git Woo! First commit. Made lint happy. Now in lint checks mode. Though a lot of spam warnings are ignored. Fixed header #defines to not have _ at the start (not according to C99 says lint). 4 errors remain: rdata.c 64: memory leak (_data not freed). rdata.c 94, 108: ntohs, ntohl undeclared. (lint is using posixlibs) config.h: using inline statement is c++. --- diff --git a/ldns/buffer.h b/ldns/buffer.h index b536939c..70bbb43a 100644 --- a/ldns/buffer.h +++ b/ldns/buffer.h @@ -10,8 +10,8 @@ * the java.nio.Buffer interface. */ -#ifndef _LDNS_BUFFER_H_ -#define _LDNS_BUFFER_H_ +#ifndef LDNS_BUFFER_H +#define LDNS_BUFFER_H #include #include @@ -502,4 +502,4 @@ void ldns_buffer_free(ldns_buffer *buffer); */ void *ldns_buffer_export(ldns_buffer *buffer); -#endif /* _LDNS_BUFFER_H_ */ +#endif /* LDNS_BUFFER_H */ diff --git a/ldns/common.h b/ldns/common.h index 7db02e08..3b1eacea 100644 --- a/ldns/common.h +++ b/ldns/common.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_COMMON_H -#define _LDNS_COMMON_H +#ifndef LDNS_COMMON_H +#define LDNS_COMMON_H #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) @@ -47,4 +47,4 @@ typedef unsigned char bool; #define ATTR_UNUSED(x) x #endif /* !HAVE_ATTR_UNUSED */ -#endif /* !_LDNS_COMMON_H */ +#endif /* LDNS_COMMON_H */ diff --git a/ldns/dname.h b/ldns/dname.h index 5962670f..b9ee354d 100644 --- a/ldns/dname.h +++ b/ldns/dname.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_DNAME_H -#define _LDNS_DNAME_H +#ifndef LDNS_DNAME_H +#define LDNS_DNAME_H #include #include @@ -123,4 +123,4 @@ bool ldns_dname_str_absolute(const char *dname_str); */ ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos); -#endif /* !_LDNS_DNAME_H */ +#endif /* LDNS_DNAME_H */ diff --git a/ldns/dns.h b/ldns/dns.h index 8d74cef9..7c3de385 100644 --- a/ldns/dns.h +++ b/ldns/dns.h @@ -11,8 +11,8 @@ * A bunch of defines that are used in the DNS. */ -#ifndef _LDNS_DNS_H_ -#define _LDNS_DNS_H_ +#ifndef LDNS_DNS_H +#define LDNS_DNS_H #include @@ -64,4 +64,4 @@ extern ldns_lookup_table ldns_rcodes[]; extern ldns_lookup_table ldns_opcodes[]; extern ldns_lookup_table ldns_edns_flags[]; -#endif /* _LDNS_DNS_H_ */ +#endif /* LDNS_DNS_H */ diff --git a/ldns/dnssec.h b/ldns/dnssec.h index 3a54a3c0..6f2ed160 100644 --- a/ldns/dnssec.h +++ b/ldns/dnssec.h @@ -8,8 +8,8 @@ * A bunch of defines that are used in the DNS */ -#ifndef _LDNS_DNSSEC_H_ -#define _LDNS_DNSSEC_H_ +#ifndef LDNS_DNSSEC_H +#define LDNS_DNSSEC_H #ifdef HAVE_SSL #include @@ -118,7 +118,6 @@ ldns_rr_list *ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys); ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); ldns_rdf *ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key); -ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); #endif /* HAVE_SSL */ /** @@ -154,4 +153,4 @@ ldns_zone *ldns_zone_sign(ldns_zone *zone, ldns_key_list *key_list); */ ldns_status ldns_init_random(FILE *fd, uint16_t bytes); -#endif /* _LDNS_DNSSEC_H_ */ +#endif /* LDNS_DNSSEC_H */ diff --git a/ldns/error.h b/ldns/error.h index a47b043b..1b66baf7 100644 --- a/ldns/error.h +++ b/ldns/error.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_ERROR_H -#define _LDNS_ERROR_H +#ifndef LDNS_ERROR_H +#define LDNS_ERROR_H #include @@ -73,4 +73,4 @@ extern ldns_lookup_table ldns_error_str[]; */ const char *ldns_get_errorstr_by_id(ldns_status err); -#endif /* _LDNS_ERROR_H */ +#endif /* LDNS_ERROR_H */ diff --git a/ldns/higher.h b/ldns/higher.h index 69ff3fcb..09decc95 100644 --- a/ldns/higher.h +++ b/ldns/higher.h @@ -11,8 +11,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_HIGHER_H -#define _LDNS_HIGHER_H +#ifndef LDNS_HIGHER_H +#define LDNS_HIGHER_H #include #include @@ -111,4 +111,4 @@ ldns_status ldns_update_send_simple_addr(const char *fqdn, const char *zone, */ void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...); -#endif /* _LDNS_HIGHER_H */ +#endif /* LDNS_HIGHER_H */ diff --git a/ldns/host2str.h b/ldns/host2str.h index b9968aa6..f4d68b54 100644 --- a/ldns/host2str.h +++ b/ldns/host2str.h @@ -8,8 +8,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_HOST2STR_H -#define _LDNS_HOST2STR_H +#ifndef LDNS_HOST2STR_H +#define LDNS_HOST2STR_H #include #include @@ -378,4 +378,4 @@ void ldns_zone_print(FILE *output, ldns_zone *z); ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, ldns_rdf *dname); -#endif +#endif /* LDNS_HOST2STR_H */ diff --git a/ldns/host2wire.h b/ldns/host2wire.h index f2d6025d..5c8401fa 100644 --- a/ldns/host2wire.h +++ b/ldns/host2wire.h @@ -8,8 +8,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_HOST2WIRE_H -#define _LDNS_HOST2WIRE_H +#ifndef LDNS_HOST2WIRE_H +#define LDNS_HOST2WIRE_H #include #include @@ -111,4 +111,4 @@ ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int, size_t *size); */ ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size); -#endif +#endif /* LDNS_HOST2WIRE_H */ diff --git a/ldns/keys.h b/ldns/keys.h index 8a34b5f9..7ec2f4da 100644 --- a/ldns/keys.h +++ b/ldns/keys.h @@ -11,8 +11,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_KEYS_H -#define _LDNS_KEYS_H +#ifndef LDNS_KEYS_H +#define LDNS_KEYS_H #ifdef HAVE_SSL #include @@ -273,4 +273,4 @@ void ldns_key_deep_free(ldns_key *key); */ void ldns_key_list_free(ldns_key_list *key_list); -#endif /* _LDNS_KEYS_H */ +#endif /* LDNS_KEYS_H */ diff --git a/ldns/net.h b/ldns/net.h index 6e0335e0..0b1007eb 100644 --- a/ldns/net.h +++ b/ldns/net.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_NET_H -#define _LDNS_NET_H +#ifndef LDNS_NET_H +#define LDNS_NET_H #include #include @@ -180,4 +180,4 @@ ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *po */ ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c); -#endif /* !_LDNS_NET_H */ +#endif /* LDNS_NET_H */ diff --git a/ldns/packet.h b/ldns/packet.h index c4661cf7..4f1f015a 100644 --- a/ldns/packet.h +++ b/ldns/packet.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_PACKET_H -#define _LDNS_PACKET_H +#ifndef LDNS_PACKET_H +#define LDNS_PACKET_H #define LDNS_MAX_PACKETLEN 65535 @@ -326,4 +326,4 @@ ldns_rr * ldns_pkt_set_rr(ldns_pkt *p, ldns_rr *rr, uint16_t n); bool ldns_pkt_insert_rr(ldns_pkt *p, ldns_rr *rr, uint16_t n); -#endif /* !_LDNS_PACKET_H */ +#endif /* LDNS_PACKET_H */ diff --git a/ldns/parse.h b/ldns/parse.h index 87dd2e3b..514fb5a6 100644 --- a/ldns/parse.h +++ b/ldns/parse.h @@ -7,8 +7,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_PARSE_H_ -#define _LDNS_PARSE_H_ +#ifndef LDNS_PARSE_H +#define LDNS_PARSE_H #include #include @@ -157,4 +157,4 @@ void ldns_fskipcs(FILE *fp, const char *s); */ void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr); -#endif /* _LDNS_PARSE_H */ +#endif /* LDNS_PARSE_H */ diff --git a/ldns/rdata.h b/ldns/rdata.h index 83fac09a..26e6d956 100644 --- a/ldns/rdata.h +++ b/ldns/rdata.h @@ -11,8 +11,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_RDATA_H -#define _LDNS_RDATA_H +#ifndef LDNS_RDATA_H +#define LDNS_RDATA_H #include #include @@ -344,4 +344,4 @@ ldns_rdf *ldns_rdf_clone(const ldns_rdf *rd); */ int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2); -#endif /* !_LDNS_RDATA_H */ +#endif /* LDNS_RDATA_H */ diff --git a/ldns/resolver.h b/ldns/resolver.h index 12999cab..2a6dd534 100644 --- a/ldns/resolver.h +++ b/ldns/resolver.h @@ -10,8 +10,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_RESOLVER_H -#define _LDNS_RESOLVER_H +#ifndef LDNS_RESOLVER_H +#define LDNS_RESOLVER_H #include #include @@ -476,4 +476,4 @@ void ldns_resolver_nameservers_randomize(ldns_resolver *r); */ ldns_resolver * ldns_update_resolver_new(const char *fqdn, const char *zone, ldns_rr_class clas, ldns_tsig_credentials *tsig_cred, ldns_rdf **zone_rdf); -#endif /* !_LDNS_RESOLVER_H */ +#endif /* LDNS_RESOLVER_H */ diff --git a/ldns/rr.h b/ldns/rr.h index 8d571927..dcdfbaa5 100644 --- a/ldns/rr.h +++ b/ldns/rr.h @@ -8,8 +8,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_RR_H -#define _LDNS_RR_H +#ifndef LDNS_RR_H +#define LDNS_RR_H #include #include @@ -679,4 +679,4 @@ ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd); /* TODO document or delete it */ bool ldns_rr_list_insert_rr(ldns_rr_list *rr_list, ldns_rr *r, size_t count); -#endif /* _LDNS_RR_H */ +#endif /* LDNS_RR_H */ diff --git a/ldns/rr_functions.h b/ldns/rr_functions.h index 51aa6bb8..63d2c5c7 100644 --- a/ldns/rr_functions.h +++ b/ldns/rr_functions.h @@ -10,8 +10,8 @@ * * See the file LICENSE for the license */ -#ifndef _LDNS_RR_FUNCTIONS_H -#define _LDNS_RR_FUNCTIONS_H +#ifndef LDNS_RR_FUNCTIONS_H +#define LDNS_RR_FUNCTIONS_H /* set rdf's at a specific offset @@ -238,4 +238,4 @@ bool ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f); */ uint16_t ldns_rr_dnskey_key_size(ldns_rr *key); -#endif /* _LDNS_RR_FUNCTIONS_H */ +#endif /* LDNS_RR_FUNCTIONS_H */ diff --git a/ldns/str2host.h b/ldns/str2host.h index d72395ba..7cf9ce4c 100644 --- a/ldns/str2host.h +++ b/ldns/str2host.h @@ -8,8 +8,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_2HOST_H -#define _LDNS_2HOST_H +#ifndef LDNS_2HOST_H +#define LDNS_2HOST_H #include #include @@ -210,4 +210,4 @@ ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str); */ ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); -#endif /* _LDNS_2HOST_H */ +#endif /* LDNS_2HOST_H */ diff --git a/ldns/tsig.h b/ldns/tsig.h index 7ff5780c..4f42242e 100644 --- a/ldns/tsig.h +++ b/ldns/tsig.h @@ -6,10 +6,10 @@ * See LICENSE for the license. */ -#ifndef _LDNS_TSIG_H_ -#define _LDNS_TSIG_H_ +#ifndef LDNS_TSIG_H +#define LDNS_TSIG_H -typedef struct _ldns_tsig_credentials +typedef struct ldns_tsig_credentials_struct { char *algorithm; char *keyname; @@ -43,4 +43,4 @@ bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const */ ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac); -#endif /* _LDNS_TSIG_H_ */ +#endif /* LDNS_TSIG_H */ diff --git a/ldns/update.h b/ldns/update.h index c2e4a2d1..c9e98fb8 100644 --- a/ldns/update.h +++ b/ldns/update.h @@ -8,8 +8,8 @@ * See LICENSE for the license. */ -#ifndef _LDNS_UPDATE_H -#define _LDNS_UPDATE_H +#ifndef LDNS_UPDATE_H +#define LDNS_UPDATE_H #include @@ -48,4 +48,4 @@ ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_clas ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class class, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf); -#endif /* !_LDNS_UPDATE_H */ +#endif /* LDNS_UPDATE_H */ diff --git a/ldns/wire2host.h b/ldns/wire2host.h index e8f6743e..e602eff8 100644 --- a/ldns/wire2host.h +++ b/ldns/wire2host.h @@ -9,8 +9,8 @@ */ -#ifndef _LDNS_WIRE2HOST_H -#define _LDNS_WIRE2HOST_H +#ifndef LDNS_WIRE2HOST_H +#define LDNS_WIRE2HOST_H #include #include @@ -176,4 +176,4 @@ ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t * */ ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); -#endif /* _LDNS_WIRE2HOST_H */ +#endif /* LDNS_WIRE2HOST_H */ diff --git a/ldns/zone.h b/ldns/zone.h index a4dc5fc8..2a3986ea 100644 --- a/ldns/zone.h +++ b/ldns/zone.h @@ -13,8 +13,8 @@ * See the file LICENSE for the license */ -#ifndef _LDNS_ZONE_H -#define _LDNS_ZONE_H +#ifndef LDNS_ZONE_H +#define LDNS_ZONE_H #include #include diff --git a/rdata.c b/rdata.c index 4cf24f72..307da62d 100644 --- a/rdata.c +++ b/rdata.c @@ -43,25 +43,25 @@ ldns_rdf_data(const ldns_rdf *rd) /* write */ void -ldns_rdf_set_size(ldns_rdf *rd, size_t s) +ldns_rdf_set_size(ldns_rdf *rd, size_t size) { assert(rd != NULL); - rd->_size = s; + rd->_size = size; } void -ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type t) +ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type) { assert(rd != NULL); - rd->_type = t; + rd->_type = type; } void -ldns_rdf_set_data(ldns_rdf *rd, void *d) +ldns_rdf_set_data(ldns_rdf *rd, void *data) { /* only copy the pointer */ assert(rd != NULL); - rd->_data = d; + rd->_data = data; } /* for types that allow it, return @@ -154,16 +154,16 @@ ldns_native2rdf_int16_data(size_t size, uint8_t *data) } ldns_rdf * -ldns_rdf_new(ldns_rdf_type t, size_t s, void *d) +ldns_rdf_new(ldns_rdf_type type, size_t size, void *data) { ldns_rdf *rd; rd = LDNS_MALLOC(ldns_rdf); if (!rd) { return NULL; } - ldns_rdf_set_size(rd, s); - ldns_rdf_set_type(rd, t); - ldns_rdf_set_data(rd, d); + ldns_rdf_set_size(rd, size); + ldns_rdf_set_type(rd, type); + ldns_rdf_set_data(rd, data); return rd; } @@ -187,13 +187,13 @@ ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data) } ldns_rdf * -ldns_rdf_clone(const ldns_rdf *r) +ldns_rdf_clone(const ldns_rdf *rd) { - assert(r != NULL); + assert(rd != NULL); return (ldns_rdf_new_frm_data( - ldns_rdf_get_type(r), - ldns_rdf_size(r), - ldns_rdf_data(r))); + ldns_rdf_get_type(rd), + ldns_rdf_size(rd), + ldns_rdf_data(rd))); } void @@ -218,7 +218,7 @@ ldns_rdf_free(ldns_rdf *rd) ldns_rdf * ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) { - ldns_rdf *rdf; + ldns_rdf *rdf=0; ldns_status status; switch (type) { @@ -334,7 +334,7 @@ ldns_rdf_new_frm_fp_l(ldns_rdf_type type, FILE *fp, int *line_nr) } ldns_rdf * -ldns_rdf_address_reverse(ldns_rdf *rdf) +ldns_rdf_address_reverse(ldns_rdf *rd) { uint8_t buf_4[LDNS_IP4ADDRLEN]; uint8_t buf_6[LDNS_IP6ADDRLEN * 2]; @@ -349,21 +349,21 @@ ldns_rdf_address_reverse(ldns_rdf *rdf) char *char_dname; int nbit; - if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_A && - ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_AAAA) { + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_AAAA) { return NULL; } in_addr = NULL; ret_dname = NULL; - switch(ldns_rdf_get_type(rdf)) { + switch(ldns_rdf_get_type(rd)) { case LDNS_RDF_TYPE_A: /* the length of the buffer is 4 */ - buf_4[3] = ldns_rdf_data(rdf)[0]; - buf_4[2] = ldns_rdf_data(rdf)[1]; - buf_4[1] = ldns_rdf_data(rdf)[2]; - buf_4[0] = ldns_rdf_data(rdf)[3]; + buf_4[3] = ldns_rdf_data(rd)[0]; + buf_4[2] = ldns_rdf_data(rd)[1]; + buf_4[1] = ldns_rdf_data(rd)[2]; + buf_4[0] = ldns_rdf_data(rd)[3]; in_addr = ldns_dname_new_frm_str("in-addr.arpa."); if (!in_addr) { return NULL; @@ -397,7 +397,7 @@ ldns_rdf_address_reverse(ldns_rdf *rdf) /* calculate nibble */ nnibble = ( ((unsigned int) nbit) & 0x04) >> 2; /* extract nibble */ - nibble = (ldns_rdf_data(rdf)[octet] & ( 0xf << (4 * (1 - nnibble)) ) ) >> ( 4 * (1 - nnibble)); + nibble = (ldns_rdf_data(rd)[octet] & ( 0xf << (4 * (1 - nnibble)) ) ) >> ( 4 * (1 - nnibble)); buf_6[(LDNS_IP6ADDRLEN * 2 - 1) - (octet * 2 + nnibble)] = (uint8_t)ldns_int_to_hexdigit((int)nibble); }