From: Kristofer Karlsson Date: Mon, 31 Dec 2012 13:02:29 +0000 (+0100) Subject: Reduce code duplication X-Git-Tag: v3.5~210^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb4ac298dd8a2de95dd3f15e361290f311d043a9;p=thirdparty%2Ftvheadend.git Reduce code duplication --- diff --git a/src/tcp.c b/src/tcp.c index 001c47094..a97b079bf 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -185,16 +185,12 @@ tcp_write_queue(int fd, htsbuf_queue_t *q) void *p; while((hd = TAILQ_FIRST(&q->hq_q)) != NULL) { - TAILQ_REMOVE(&q->hq_q, hd, hd_link); - if (!r) { l = hd->hd_data_len - hd->hd_data_off; p = hd->hd_data + hd->hd_data_off; r = tvh_write(fd, p, l); } - - free(hd->hd_data); - free(hd); + htsbuf_data_free(q, hd); } q->hq_size = 0; return r;