From 606f570c3d6940e7453f9b47140fdfba08ea3c92 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 29 Jan 2016 22:18:28 +1100 Subject: [PATCH] Use faster and more robust memchr for detecting EOL in read_socket_line --- src/ckpool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 1d12b271..4f30d15c 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -654,7 +654,7 @@ int read_socket_line(connsock_t *cs, float *timeout) clear_bufline(cs); recv_available(ckp, cs); // Intentionally ignore return value - eom = strchr(cs->buf, '\n'); + eom = memchr(cs->buf, '\n', cs->bufofs); tv_time(&start); @@ -692,7 +692,7 @@ int read_socket_line(connsock_t *cs, float *timeout) ret = -1; goto out; } - eom = strchr(cs->buf, '\n'); + eom = memchr(cs->buf, '\n', cs->bufofs); tv_time(&now); diff = tvdiff(&now, &start); copy_tv(&start, &now);