~mdw
/
adns
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
regress/Makefile.in: More out-of-tree build hacking.
[adns]
/
src
/
query.c
diff --git
a/src/query.c
b/src/query.c
index
31adfc4
..
46d6969
100644
(file)
--- a/
src/query.c
+++ b/
src/query.c
@@
-105,7
+105,9
@@
static void query_submit(adns_state ads, adns_query qu,
qu->query_dglen= qu->vb.used;
memcpy(qu->query_dgram,qu->vb.buf,qu->vb.used);
qu->query_dglen= qu->vb.used;
memcpy(qu->query_dgram,qu->vb.buf,qu->vb.used);
- if (typei->query_send && !(qu->flags & adns__qf_senddirect))
+ if (flags & adns__qf_nosend)
+ ;
+ else if (typei->query_send && !(flags & adns__qf_senddirect))
typei->query_send(qu,now);
else
adns__query_send(qu, now);
typei->query_send(qu,now);
else
adns__query_send(qu, now);
@@
-118,7
+120,7
@@
adns_status adns__internal_submit(adns_state ads, adns_query *query_r,
const qcontext *ctx) {
adns_query qu;
const qcontext *ctx) {
adns_query qu;
- qu= query_alloc(ads,typei,type,flags,now);
+ qu= query_alloc(ads,typei,type,flags
& ~adns__qf_nosend
,now);
if (!qu) { adns__vbuf_free(qumsg_vb); return adns_s_nomemory; }
*query_r= qu;
if (!qu) { adns__vbuf_free(qumsg_vb); return adns_s_nomemory; }
*query_r= qu;
@@
-388,13
+390,22
@@
void *adns__alloc_preserved(adns_query qu, size_t sz) {
return rv;
}
return rv;
}
-void adns__free_interim(adns_query qu, void *p) {
+static allocnode *alloc_info(void *p, size_t *sz_r)
+{
allocnode *an;
allocnode *an;
- size_t sz;
- if (!p)
return;
+ if (!p)
{ *sz_r = 0; return 0; }
an = (allocnode *)((byte *)p - MEM_ROUND(sizeof(allocnode)));
an = (allocnode *)((byte *)p - MEM_ROUND(sizeof(allocnode)));
- sz = MEM_ROUND(an->sz);
+ *sz_r = MEM_ROUND(an->sz);
+ return an;
+}
+
+void adns__free_interim(adns_query qu, void *p) {
+ size_t sz;
+ allocnode *an = alloc_info(p, &sz);
+
+ if (!an) return;
+ assert(!qu->final_allocspace);
LIST_UNLINK(qu->allocations, an);
free(an);
qu->interim_allocd -= sz;
LIST_UNLINK(qu->allocations, an);
free(an);
qu->interim_allocd -= sz;
@@
-404,12
+415,11
@@
void *adns__alloc_mine(adns_query qu, size_t sz) {
return alloc_common(qu,MEM_ROUND(sz));
}
return alloc_common(qu,MEM_ROUND(sz));
}
-void adns__transfer_interim(adns_query from, adns_query to,
- void *block, size_t sz) {
- allocnode *an;
+void adns__transfer_interim(adns_query from, adns_query to,
void *block) {
+ size_t sz;
+ allocnode *an
= alloc_info(block, &sz)
;
- if (!block) return;
- an= (void*)((byte*)block - MEM_ROUND(sizeof(*an)));
+ if (!an) return;
assert(!to->final_allocspace);
assert(!from->final_allocspace);
assert(!to->final_allocspace);
assert(!from->final_allocspace);
@@
-417,7
+427,6
@@
void adns__transfer_interim(adns_query from, adns_query to,
LIST_UNLINK(from->allocations,an);
LIST_LINK_TAIL(to->allocations,an);
LIST_UNLINK(from->allocations,an);
LIST_LINK_TAIL(to->allocations,an);
- sz= MEM_ROUND(sz);
from->interim_allocd -= sz;
to->interim_allocd += sz;
from->interim_allocd -= sz;
to->interim_allocd += sz;