+10 March 2010: Wouter
+ - --enable-alloc-lite works with test set.
+
9 March 2010: Wouter
- tag 1.4.2 created.
- trunk is 1.4.3 in development.
if(!rdf) {
return 0;
}
+#ifdef UNBOUND_ALLOC_LITE
+ qinfo->qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf));
+ qinfo->qname_len = ldns_rdf_size(rdf);
+ ldns_rdf_deep_free(rdf);
+ rdf = 0;
+#else
qinfo->qname = ldns_rdf_data(rdf);
qinfo->qname_len = ldns_rdf_size(rdf);
+#endif
edns->edns_present = 1;
edns->ext_rcode = 0;
edns->edns_version = 0;
#undef free
#undef realloc
#endif
+#ifdef UNBOUND_ALLOC_LITE
+#undef malloc
+#undef calloc
+#undef free
+#undef realloc
+#undef strdup
+char* unbound_lite_wrapstr(char* s) { return s; }
+#endif
#include "libunbound/unbound.h"
#include <ldns/ldns.h>
#include "libunbound/context.h"
#include "util/locks.h"
#include "util/log.h"
+#ifdef UNBOUND_ALLOC_LITE
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+#undef strdup
+#endif
/** keeping track of the async ids */
struct track_id {
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
+#ifdef UNBOUND_ALLOC_LITE
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+#undef strdup
+char* unbound_lite_wrapstr(char* s) { return s; }
+#endif
struct todo_item;
struct labdata;
memmove(n, s, l);
return n;
}
+
+char* unbound_lite_wrapstr(char* s)
+{
+ char* n = unbound_strdup_lite(s, __FILE__, __LINE__, __func__);
+ free(s);
+ return n;
+}
+
+#undef ldns_pkt2wire
+ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p,
+ size_t *size)
+{
+ uint8_t* md = NULL;
+ size_t ms = 0;
+ ldns_status s = ldns_pkt2wire(&md, p, &ms);
+ if(md) {
+ *dest = unbound_stat_malloc_lite(ms, __FILE__, __LINE__,
+ __func__);
+ *size = ms;
+ if(!*dest) { free(md); return LDNS_STATUS_MEM_ERR; }
+ memcpy(*dest, md, ms);
+ free(md);
+ } else {
+ *dest = NULL;
+ *size = 0;
+ }
+ return s;
+}
+
+#undef i2d_DSA_SIG
+int unbound_lite_i2d_DSA_SIG(DSA_SIG* dsasig, unsigned char** sig)
+{
+ unsigned char* n = NULL;
+ int r= i2d_DSA_SIG(dsasig, &n);
+ if(n) {
+ *sig = unbound_stat_malloc_lite((size_t)r, __FILE__, __LINE__,
+ __func__);
+ if(!*sig) return -1;
+ memcpy(*sig, n, (size_t)r);
+ free(n);
+ return r;
+ }
+ *sig = NULL;
+ return r;
+}
+
#endif /* UNBOUND_ALLOC_LITE */
# define strdup(s) unbound_strdup_lite(s, __FILE__, __LINE__, __func__)
char* unbound_strdup_lite(const char* s, const char* file, int line,
const char* func);
+char* unbound_lite_wrapstr(char* s);
+# define ldns_rr2str(rr) unbound_lite_wrapstr(ldns_rr2str(rr))
+# define ldns_rdf2str(rdf) unbound_lite_wrapstr(ldns_rdf2str(rdf))
+# define ldns_rr_type2str(t) unbound_lite_wrapstr(ldns_rr_type2str(t))
+# define ldns_rr_class2str(c) unbound_lite_wrapstr(ldns_rr_class2str(c))
+# define ldns_rr_list2str(r) unbound_lite_wrapstr(ldns_rr_list2str(r))
+# define ldns_pkt2str(p) unbound_lite_wrapstr(ldns_pkt2str(p))
+# define ldns_pkt_rcode2str(r) unbound_lite_wrapstr(ldns_pkt_rcode2str(r))
+# define ldns_pkt2wire(a, r, s) unbound_lite_pkt2wire(a, r, s)
+ldns_status unbound_lite_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size);
+# define i2d_DSA_SIG(d, s) unbound_lite_i2d_DSA_SIG(d, s)
+int unbound_lite_i2d_DSA_SIG(DSA_SIG* dsasig, unsigned char** sig);
#endif /* UNBOUND_ALLOC_LITE */
#endif /* UTIL_ALLOC_H */