CLEANUP: applet: use applet_put*() everywhere possible
This applies the change so that the applet code stops using ci_putchk()
and friends everywhere possible, for the much saferapplet_put*() instead.
The change is mechanical but large. Two or three functions used to have no
appctx and a cs derived from the appctx instead, which was a reminiscence
of old times' stream_interface. These were simply changed to directly take
the appctx. No sensitive change was performed, and the old (more complex)
API is still usable when needed (e.g. the channel is already known).
The change touched roughly a hundred of locations, with no less than 124
lines removed.
It's worth noting that the stats applet, the oldest of the series, could
get a serious lifting, as it's still very channel-centric instead of
propagating the appctx along the chain. Given that this code doesn't
change often, there's no emergency to clean it up but it would look
better.
diff --git a/src/dns.c b/src/dns.c
index 713008e..3ed6892 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -544,7 +544,7 @@
/* put msg len into then channel */
slen = (uint16_t)msg_len;
slen = htons(slen);
- ci_putblk(cs_ic(cs), (char *)&slen, sizeof(slen));
+ applet_putblk(appctx, (char *)&slen, sizeof(slen));
available_room -= sizeof(slen);
/* backup original query id */
@@ -562,7 +562,7 @@
new_qid = htons(new_qid);
/* put new query id into the channel */
- ci_putblk(cs_ic(cs), (char *)&new_qid, sizeof(new_qid));
+ applet_putblk(appctx, (char *)&new_qid, sizeof(new_qid));
available_room -= sizeof(new_qid);
/* keep query id mapping */
@@ -617,12 +617,11 @@
}
trash.data += len;
- if (ci_putchk(cs_ic(cs), &trash) == -1) {
+ if (applet_putchk(appctx, &trash) == -1) {
/* should never happen since we
* check available_room is large
* enough here.
*/
- cs_rx_room_blk(cs);
ret = 0;
break;
}