From 4ac1880a33a31144592a93d95fff715d67a6bf05 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 9 Jul 2015 11:20:27 +0200 Subject: [PATCH] make dump_peer_options clearer (and address CID 740350) --- src/neighbors.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/neighbors.cc b/src/neighbors.cc index 9f8b05201a..6a42df0ec9 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1492,15 +1492,23 @@ dump_peer_options(StoreEntry * sentry, CachePeer * p) if (p->options.htcp) { storeAppendPrintf(sentry, " htcp"); if (p->options.htcp_oldsquid || p->options.htcp_no_clr || p->options.htcp_no_purge_clr || p->options.htcp_only_clr) { - int doneopts=0; - if (p->options.htcp_oldsquid) - storeAppendPrintf(sentry, "%soldsquid",(doneopts++>0?",":"=")); - if (p->options.htcp_no_clr) - storeAppendPrintf(sentry, "%sno-clr",(doneopts++>0?",":"=")); - if (p->options.htcp_no_purge_clr) - storeAppendPrintf(sentry, "%sno-purge-clr",(doneopts++>0?",":"=")); - if (p->options.htcp_only_clr) - storeAppendPrintf(sentry, "%sonly-clr",(doneopts++>0?",":"=")); + bool doneopts = false; + if (p->options.htcp_oldsquid) { + storeAppendPrintf(sentry, "oldsquid"); + doneopts = true; + } + if (p->options.htcp_no_clr) { + storeAppendPrintf(sentry, "%sno-clr",(doneopts?",":"=")); + doneopts = true; + } + if (p->options.htcp_no_purge_clr) { + storeAppendPrintf(sentry, "%sno-purge-clr",(doneopts?",":"=")); + doneopts = true; + } + if (p->options.htcp_only_clr) { + storeAppendPrintf(sentry, "%sonly-clr",(doneopts?",":"=")); + //doneopts = true; // uncomment if more opts are added + } } } #endif -- 2.39.5