]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: simplify the use of the int to ascii macros
authorWilly Tarreau <w@1wt.eu>
Sun, 23 Dec 2012 17:00:29 +0000 (18:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 23 Dec 2012 20:46:30 +0000 (21:46 +0100)
These macros (U2H, U2A, LIM2A, ...) have been used with an explicit
index for the local storage variable, making it difficult to change
log formats and causing a few issues from time to time. Let's have
a single macro with a rotating index so that up to 10 conversions
may be used in a single call.

include/common/standard.h
src/dumpstats.c
src/standard.c

index 221d8b880d20e1175f7462ebf8c1abd1ab9c4a02..b1db8213bd6aea553eee23e9974be8da2bb25d8d 100644 (file)
@@ -41,6 +41,8 @@
 # define ULLONG_MAX    (LLONG_MAX * 2ULL + 1)
 #endif
 
+/* number of itoa_str entries */
+#define NB_ITOA_STR    10
 
 /****** string-specific macros and functions ******/
 /* if a > max, then bound <a> to <max>. The macro returns the new <a> */
@@ -62,6 +64,8 @@ enum {
        STD_OP_GE = 4, STD_OP_LT = 5,
 };
 
+extern int itoa_idx; /* index of next itoa_str to use */
+
 /*
  * copies at most <size-1> chars from <src> to <dst>. Last char is always
  * set to 0, unless <size> is 0. The number of chars copied is returned
@@ -123,32 +127,6 @@ char *lltoa(long long n, char *dst, size_t size);
  */
 char *utoa_pad(unsigned int n, char *dst, size_t size);
 
-/* Fast macros to convert up to 10 different parameters inside a same call of
- * expression.
- */
-#define U2A0(n) ({ ultoa_r((n), itoa_str[0], sizeof(itoa_str[0])); })
-#define U2A1(n) ({ ultoa_r((n), itoa_str[1], sizeof(itoa_str[1])); })
-#define U2A2(n) ({ ultoa_r((n), itoa_str[2], sizeof(itoa_str[2])); })
-#define U2A3(n) ({ ultoa_r((n), itoa_str[3], sizeof(itoa_str[3])); })
-#define U2A4(n) ({ ultoa_r((n), itoa_str[4], sizeof(itoa_str[4])); })
-#define U2A5(n) ({ ultoa_r((n), itoa_str[5], sizeof(itoa_str[5])); })
-#define U2A6(n) ({ ultoa_r((n), itoa_str[6], sizeof(itoa_str[6])); })
-#define U2A7(n) ({ ultoa_r((n), itoa_str[7], sizeof(itoa_str[7])); })
-#define U2A8(n) ({ ultoa_r((n), itoa_str[8], sizeof(itoa_str[8])); })
-#define U2A9(n) ({ ultoa_r((n), itoa_str[9], sizeof(itoa_str[9])); })
-
-/* The same macros provide HTML encoding of numbers */
-#define U2H0(n) ({ ulltoh_r((n), itoa_str[0], sizeof(itoa_str[0])); })
-#define U2H1(n) ({ ulltoh_r((n), itoa_str[1], sizeof(itoa_str[1])); })
-#define U2H2(n) ({ ulltoh_r((n), itoa_str[2], sizeof(itoa_str[2])); })
-#define U2H3(n) ({ ulltoh_r((n), itoa_str[3], sizeof(itoa_str[3])); })
-#define U2H4(n) ({ ulltoh_r((n), itoa_str[4], sizeof(itoa_str[4])); })
-#define U2H5(n) ({ ulltoh_r((n), itoa_str[5], sizeof(itoa_str[5])); })
-#define U2H6(n) ({ ulltoh_r((n), itoa_str[6], sizeof(itoa_str[6])); })
-#define U2H7(n) ({ ulltoh_r((n), itoa_str[7], sizeof(itoa_str[7])); })
-#define U2H8(n) ({ ulltoh_r((n), itoa_str[8], sizeof(itoa_str[8])); })
-#define U2H9(n) ({ ulltoh_r((n), itoa_str[9], sizeof(itoa_str[9])); })
-
 /*
  * This function simply returns a locally allocated string containing the ascii
  * representation for number 'n' in decimal, unless n is 0 in which case it
@@ -159,19 +137,44 @@ char *utoa_pad(unsigned int n, char *dst, size_t size);
  */
 extern const char *limit_r(unsigned long n, char *buffer, int size, const char *alt);
 
-/* Fast macros to convert up to 10 different parameters inside a same call of
- * expression. Warning! they share the same vectors as U2A*!
- */
-#define LIM2A0(n, alt) ({ limit_r((n), itoa_str[0], sizeof(itoa_str[0]), (alt)); })
-#define LIM2A1(n, alt) ({ limit_r((n), itoa_str[1], sizeof(itoa_str[1]), (alt)); })
-#define LIM2A2(n, alt) ({ limit_r((n), itoa_str[2], sizeof(itoa_str[2]), (alt)); })
-#define LIM2A3(n, alt) ({ limit_r((n), itoa_str[3], sizeof(itoa_str[3]), (alt)); })
-#define LIM2A4(n, alt) ({ limit_r((n), itoa_str[4], sizeof(itoa_str[4]), (alt)); })
-#define LIM2A5(n, alt) ({ limit_r((n), itoa_str[5], sizeof(itoa_str[5]), (alt)); })
-#define LIM2A6(n, alt) ({ limit_r((n), itoa_str[6], sizeof(itoa_str[6]), (alt)); })
-#define LIM2A7(n, alt) ({ limit_r((n), itoa_str[7], sizeof(itoa_str[7]), (alt)); })
-#define LIM2A8(n, alt) ({ limit_r((n), itoa_str[8], sizeof(itoa_str[8]), (alt)); })
-#define LIM2A9(n, alt) ({ limit_r((n), itoa_str[9], sizeof(itoa_str[9]), (alt)); })
+/* returns a locally allocated string containing the ASCII representation of
+ * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in the same
+ * function call (eg: printf), shared with the other similar functions making
+ * use of itoa_str[].
+ */
+static inline const char *U2A(unsigned long n)
+{
+       const char *ret = ultoa_r(n, itoa_str[itoa_idx], sizeof(itoa_str[0]));
+       if (++itoa_idx >= NB_ITOA_STR)
+               itoa_idx = 0;
+       return ret;
+}
+
+/* returns a locally allocated string containing the HTML representation of
+ * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in the same
+ * function call (eg: printf), shared with the other similar functions making
+ * use of itoa_str[].
+ */
+static inline const char *U2H(unsigned long long n)
+{
+       const char *ret = ulltoh_r(n, itoa_str[itoa_idx], sizeof(itoa_str[0]));
+       if (++itoa_idx >= NB_ITOA_STR)
+               itoa_idx = 0;
+       return ret;
+}
+
+/* returns a locally allocated string containing the HTML representation of
+ * the number 'n' in decimal. Up to NB_ITOA_STR calls may be used in the same
+ * function call (eg: printf), shared with the other similar functions making
+ * use of itoa_str[].
+ */
+static inline const char *LIM2A(unsigned long n, const char *alt)
+{
+       const char *ret = limit_r(n, itoa_str[itoa_idx], sizeof(itoa_str[0]), alt);
+       if (++itoa_idx >= NB_ITOA_STR)
+               itoa_idx = 0;
+       return ret;
+}
 
 /*
  * Returns non-zero if character <s> is a hex digit (0-9, a-f, A-F), else zero.
index 526349b506ec3fd746a2df82918d3ef1d2ce73fe..3a890f3c15225a0859af585f6902ec9b5ec97ed7 100644 (file)
@@ -1839,14 +1839,14 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                              "<tr><th>Current connection rate:</th><td>%s/s</td></tr>"
                              "<tr><th>Current session rate:</th><td>%s/s</td></tr>"
                              "",
-                             U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
-                             U2H1(read_freq_ctr(&px->fe_conn_per_sec)),
-                             U2H2(read_freq_ctr(&px->fe_sess_per_sec)));
+                             U2H(read_freq_ctr(&px->fe_sess_per_sec)),
+                             U2H(read_freq_ctr(&px->fe_conn_per_sec)),
+                             U2H(read_freq_ctr(&px->fe_sess_per_sec)));
 
                if (px->mode == PR_MODE_HTTP)
                        chunk_appendf(&trash,
                                      "<tr><th>Current request rate:</th><td>%s/s</td></tr>",
-                                     U2H3(read_freq_ctr(&px->fe_req_per_sec)));
+                                     U2H(read_freq_ctr(&px->fe_req_per_sec)));
 
                chunk_appendf(&trash,
                              "</table></div></u></td>"
@@ -1855,20 +1855,20 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                              "<tr><th>Max connection rate:</th><td>%s/s</td></tr>"
                              "<tr><th>Max session rate:</th><td>%s/s</td></tr>"
                              "",
-                             U2H0(px->fe_counters.sps_max),
-                             U2H1(px->fe_counters.cps_max),
-                             U2H2(px->fe_counters.sps_max));
+                             U2H(px->fe_counters.sps_max),
+                             U2H(px->fe_counters.cps_max),
+                             U2H(px->fe_counters.sps_max));
 
                if (px->mode == PR_MODE_HTTP)
                        chunk_appendf(&trash,
                                      "<tr><th>Max request rate:</th><td>%s/s</td></tr>",
-                                     U2H3(px->fe_counters.p.http.rps_max));
+                                     U2H(px->fe_counters.p.http.rps_max));
 
                chunk_appendf(&trash,
                              "</table></div></u></td>"
                              /* sessions rate : limit */
                              "<td>%s</td>",
-                             LIM2A4(px->fe_sps_lim, "-"));
+                             LIM2A(px->fe_sps_lim, "-"));
 
                chunk_appendf(&trash,
                              /* sessions: current, max, limit, total */
@@ -1877,10 +1877,10 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                              "<tr><th>Cum. connections:</th><td>%s</td></tr>"
                              "<tr><th>Cum. sessions:</th><td>%s</td></tr>"
                              "",
-                             U2H0(px->feconn), U2H1(px->fe_counters.conn_max), U2H2(px->maxconn),
-                             U2H3(px->fe_counters.cum_sess),
-                             U2H4(px->fe_counters.cum_conn),
-                             U2H5(px->fe_counters.cum_sess));
+                             U2H(px->feconn), U2H(px->fe_counters.conn_max), U2H(px->maxconn),
+                             U2H(px->fe_counters.cum_sess),
+                             U2H(px->fe_counters.cum_conn),
+                             U2H(px->fe_counters.cum_sess));
 
                /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */
                if (px->mode == PR_MODE_HTTP) {
@@ -1895,17 +1895,17 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                                      "<tr><th>- other responses:</th><td>%s</td></tr>"
                                      "<tr><th>Intercepted requests:</th><td>%s</td></tr>"
                                      "",
-                                     U2H0(px->fe_counters.p.http.cum_req),
-                                     U2H1(px->fe_counters.p.http.rsp[1]),
-                                     U2H2(px->fe_counters.p.http.rsp[2]),
-                                     U2H3(px->fe_counters.p.http.comp_rsp),
+                                     U2H(px->fe_counters.p.http.cum_req),
+                                     U2H(px->fe_counters.p.http.rsp[1]),
+                                     U2H(px->fe_counters.p.http.rsp[2]),
+                                     U2H(px->fe_counters.p.http.comp_rsp),
                                      px->fe_counters.p.http.rsp[2] ?
                                      (int)(100*px->fe_counters.p.http.comp_rsp/px->fe_counters.p.http.rsp[2]) : 0,
-                                     U2H4(px->fe_counters.p.http.rsp[3]),
-                                     U2H5(px->fe_counters.p.http.rsp[4]),
-                                     U2H6(px->fe_counters.p.http.rsp[5]),
-                                     U2H7(px->fe_counters.p.http.rsp[0]),
-                                     U2H8(px->fe_counters.intercepted_req));
+                                     U2H(px->fe_counters.p.http.rsp[3]),
+                                     U2H(px->fe_counters.p.http.rsp[4]),
+                                     U2H(px->fe_counters.p.http.rsp[5]),
+                                     U2H(px->fe_counters.p.http.rsp[0]),
+                                     U2H(px->fe_counters.intercepted_req));
                }
 
                chunk_appendf(&trash,
@@ -1915,13 +1915,13 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                              /* bytes : in */
                              "<td>%s</td>"
                              "",
-                             U2H7(px->fe_counters.bytes_in));
+                             U2H(px->fe_counters.bytes_in));
 
                chunk_appendf(&trash,
                              /* bytes:out + compression stats (via hover): comp_in, comp_out, comp_byp */
                              "<td>%s%s<div>compression: in=%lld out=%lld bypassed=%lld savings=%d%%</div>%s</td>",
                              (px->fe_counters.comp_in || px->fe_counters.comp_byp) ? "<u>":"",
-                             U2H0(px->fe_counters.bytes_out),
+                             U2H(px->fe_counters.bytes_out),
                              px->fe_counters.comp_in, px->fe_counters.comp_out, px->fe_counters.comp_byp,
                              px->fe_counters.comp_in ?
                              (int)((px->fe_counters.comp_in - px->fe_counters.comp_out)*100/px->fe_counters.comp_in) : 0,
@@ -1939,8 +1939,8 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
                              /* rest of server: nothing */
                              "<td class=ac colspan=8></td></tr>"
                              "",
-                             U2H0(px->fe_counters.denied_req), U2H1(px->fe_counters.denied_resp),
-                             U2H2(px->fe_counters.failed_req),
+                             U2H(px->fe_counters.denied_req), U2H(px->fe_counters.denied_resp),
+                             U2H(px->fe_counters.failed_req),
                              px->state == PR_STREADY ? "OPEN" :
                              px->state == PR_STFULL ? "FULL" : "STOP");
        }
@@ -2073,8 +2073,8 @@ static int stats_dump_li_stats(struct stream_interface *si, struct proxy *px, st
                              "<td>%s</td><td>%s</td>"
                              "",
                              (flags & ST_SHLGNDS)?"</u>":"",
-                             U2H3(l->nbconn), U2H4(l->counters->conn_max), U2H5(l->maxconn),
-                             U2H6(l->counters->cum_conn), U2H7(l->counters->bytes_in), U2H8(l->counters->bytes_out));
+                             U2H(l->nbconn), U2H(l->counters->conn_max), U2H(l->maxconn),
+                             U2H(l->counters->cum_conn), U2H(l->counters->bytes_in), U2H(l->counters->bytes_out));
 
                chunk_appendf(&trash,
                              /* denied: req, resp */
@@ -2088,8 +2088,8 @@ static int stats_dump_li_stats(struct stream_interface *si, struct proxy *px, st
                              /* rest of server: nothing */
                              "<td class=ac colspan=8></td></tr>"
                              "",
-                             U2H0(l->counters->denied_req), U2H1(l->counters->denied_resp),
-                             U2H2(l->counters->failed_req),
+                             U2H(l->counters->denied_req), U2H(l->counters->denied_resp),
+                             U2H(l->counters->failed_req),
                              (l->nbconn < l->maxconn) ? (l->state == LI_LIMITED) ? "WAITING" : "OPEN" : "FULL");
        }
        else { /* CSV mode */
@@ -2226,8 +2226,8 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                              "<td>%s</td><td>%s</td><td></td>"
                              "",
                              (flags & ST_SHLGNDS) ? "</u>" : "",
-                             U2H0(sv->nbpend), U2H1(sv->counters.nbpend_max), LIM2A2(sv->maxqueue, "-"),
-                             U2H3(read_freq_ctr(&sv->sess_per_sec)), U2H4(sv->counters.sps_max));
+                             U2H(sv->nbpend), U2H(sv->counters.nbpend_max), LIM2A(sv->maxqueue, "-"),
+                             U2H(read_freq_ctr(&sv->sess_per_sec)), U2H(sv->counters.sps_max));
 
 
                chunk_appendf(&trash,
@@ -2236,9 +2236,9 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                              "<td><u>%s<div><table class=det>"
                              "<tr><th>Cum. sessions:</th><td>%s</td></tr>"
                              "",
-                             U2H0(sv->cur_sess), U2H1(sv->counters.cur_sess_max), LIM2A2(sv->maxconn, "-"),
-                             U2H3(sv->counters.cum_sess),
-                             U2H4(sv->counters.cum_sess));
+                             U2H(sv->cur_sess), U2H(sv->counters.cur_sess_max), LIM2A(sv->maxconn, "-"),
+                             U2H(sv->counters.cum_sess),
+                             U2H(sv->counters.cum_sess));
 
                /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */
                if (px->mode == PR_MODE_HTTP) {
@@ -2255,20 +2255,20 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                                      "<tr><th>- HTTP 5xx responses:</th><td>%s</td><td>(%d%%)</td></tr>"
                                      "<tr><th>- other responses:</th><td>%s</td><td>(%d%%)</td></tr>"
                                      "",
-                                     U2H0(tot),
-                                     U2H1(sv->counters.p.http.rsp[1]), tot ? (int)(100*sv->counters.p.http.rsp[1] / tot) : 0,
-                                     U2H2(sv->counters.p.http.rsp[2]), tot ? (int)(100*sv->counters.p.http.rsp[2] / tot) : 0,
-                                     U2H3(sv->counters.p.http.rsp[3]), tot ? (int)(100*sv->counters.p.http.rsp[3] / tot) : 0,
-                                     U2H4(sv->counters.p.http.rsp[4]), tot ? (int)(100*sv->counters.p.http.rsp[4] / tot) : 0,
-                                     U2H5(sv->counters.p.http.rsp[5]), tot ? (int)(100*sv->counters.p.http.rsp[5] / tot) : 0,
-                                     U2H6(sv->counters.p.http.rsp[0]), tot ? (int)(100*sv->counters.p.http.rsp[0] / tot) : 0);
+                                     U2H(tot),
+                                     U2H(sv->counters.p.http.rsp[1]), tot ? (int)(100*sv->counters.p.http.rsp[1] / tot) : 0,
+                                     U2H(sv->counters.p.http.rsp[2]), tot ? (int)(100*sv->counters.p.http.rsp[2] / tot) : 0,
+                                     U2H(sv->counters.p.http.rsp[3]), tot ? (int)(100*sv->counters.p.http.rsp[3] / tot) : 0,
+                                     U2H(sv->counters.p.http.rsp[4]), tot ? (int)(100*sv->counters.p.http.rsp[4] / tot) : 0,
+                                     U2H(sv->counters.p.http.rsp[5]), tot ? (int)(100*sv->counters.p.http.rsp[5] / tot) : 0,
+                                     U2H(sv->counters.p.http.rsp[0]), tot ? (int)(100*sv->counters.p.http.rsp[0] / tot) : 0);
                }
 
                chunk_appendf(&trash,
                              "</table></div></u></td>"
                              /* sessions: lbtot */
                              "<td>%s</td>",
-                             U2H1(sv->counters.cum_lbconn));
+                             U2H(sv->counters.cum_lbconn));
 
                chunk_appendf(&trash,
                              /* bytes : in, out */
@@ -2282,10 +2282,10 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                              /* warnings: retries, redispatches */
                              "<td>%lld</td><td>%lld</td>"
                              "",
-                             U2H0(sv->counters.bytes_in), U2H1(sv->counters.bytes_out),
-                             U2H2(sv->counters.failed_secu),
-                             U2H3(sv->counters.failed_conns),
-                             U2H6(sv->counters.failed_resp),
+                             U2H(sv->counters.bytes_in), U2H(sv->counters.bytes_out),
+                             U2H(sv->counters.failed_secu),
+                             U2H(sv->counters.failed_conns),
+                             U2H(sv->counters.failed_resp),
                              sv->counters.cli_aborts,
                              sv->counters.srv_aborts,
                              sv->counters.retries, sv->counters.redispatches);
@@ -2403,7 +2403,7 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                              "",
                              px->id, sv->id,
                              sv->nbpend, sv->counters.nbpend_max,
-                             sv->cur_sess, sv->counters.cur_sess_max, LIM2A0(sv->maxconn, ""), sv->counters.cum_sess,
+                             sv->cur_sess, sv->counters.cur_sess_max, LIM2A(sv->maxconn, ""), sv->counters.cum_sess,
                              sv->counters.bytes_in, sv->counters.bytes_out,
                              sv->counters.failed_secu,
                              sv->counters.failed_conns, sv->counters.failed_resp,
@@ -2441,7 +2441,7 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
                chunk_appendf(&trash,
                              "%s,"
                              "%d,%d,%d,",
-                             LIM2A0(sv->maxqueue, ""),
+                             LIM2A(sv->maxqueue, ""),
                              relative_pid, px->uuid, sv->puid);
 
                /* throttle */
@@ -2570,8 +2570,8 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
                              "<td>%s</td><td>%s</td><td></td>"
                              "",
                              (flags & ST_SHLGNDS)?"</u>":"",
-                             U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->be_counters.nbpend_max),
-                             U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->be_counters.sps_max));
+                             U2H(px->nbpend) /* or px->totpend ? */, U2H(px->be_counters.nbpend_max),
+                             U2H(read_freq_ctr(&px->be_sess_per_sec)), U2H(px->be_counters.sps_max));
 
                chunk_appendf(&trash,
                              /* sessions: current, max, limit, total */
@@ -2579,9 +2579,9 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
                              "<td><u>%s<div><table class=det>"
                              "<tr><th>Cum. sessions:</th><td>%s</td></tr>"
                              "",
-                             U2H0(px->beconn), U2H1(px->be_counters.conn_max), U2H2(px->fullconn),
-                             U2H3(px->be_counters.cum_conn),
-                             U2H4(px->be_counters.cum_conn));
+                             U2H(px->beconn), U2H(px->be_counters.conn_max), U2H(px->fullconn),
+                             U2H(px->be_counters.cum_conn),
+                             U2H(px->be_counters.cum_conn));
 
                /* http response (via hover): 1xx, 2xx, 3xx, 4xx, 5xx, other */
                if (px->mode == PR_MODE_HTTP) {
@@ -2596,17 +2596,17 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
                                      "<tr><th>- other responses:</th><td>%s</td></tr>"
                                      "<tr><th>Intercepted requests:</th><td>%s</td></tr>"
                                      "",
-                                     U2H0(px->be_counters.p.http.cum_req),
-                                     U2H1(px->be_counters.p.http.rsp[1]),
-                                     U2H2(px->be_counters.p.http.rsp[2]),
-                                     U2H3(px->be_counters.p.http.comp_rsp),
+                                     U2H(px->be_counters.p.http.cum_req),
+                                     U2H(px->be_counters.p.http.rsp[1]),
+                                     U2H(px->be_counters.p.http.rsp[2]),
+                                     U2H(px->be_counters.p.http.comp_rsp),
                                      px->be_counters.p.http.rsp[2] ?
                                      (int)(100*px->be_counters.p.http.comp_rsp/px->be_counters.p.http.rsp[2]) : 0,
-                                     U2H4(px->be_counters.p.http.rsp[3]),
-                                     U2H5(px->be_counters.p.http.rsp[4]),
-                                     U2H6(px->be_counters.p.http.rsp[5]),
-                                     U2H7(px->be_counters.p.http.rsp[0]),
-                                     U2H8(px->be_counters.intercepted_req));
+                                     U2H(px->be_counters.p.http.rsp[3]),
+                                     U2H(px->be_counters.p.http.rsp[4]),
+                                     U2H(px->be_counters.p.http.rsp[5]),
+                                     U2H(px->be_counters.p.http.rsp[0]),
+                                     U2H(px->be_counters.intercepted_req));
                }
 
                chunk_appendf(&trash,
@@ -2616,14 +2616,14 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
                              /* bytes: in */
                              "<td>%s</td>"
                              "",
-                             U2H7(px->be_counters.cum_lbconn),
-                             U2H8(px->be_counters.bytes_in));
+                             U2H(px->be_counters.cum_lbconn),
+                             U2H(px->be_counters.bytes_in));
 
                chunk_appendf(&trash,
                              /* bytes:out + compression stats (via hover): comp_in, comp_out, comp_byp */
                              "<td>%s%s<div>compression: in=%lld out=%lld bypassed=%lld savings=%d%%</div>%s</td>",
                              (px->be_counters.comp_in || px->be_counters.comp_byp) ? "<u>":"",
-                             U2H0(px->be_counters.bytes_out),
+                             U2H(px->be_counters.bytes_out),
                              px->be_counters.comp_in, px->be_counters.comp_out, px->be_counters.comp_byp,
                              px->be_counters.comp_in ?
                              (int)((px->be_counters.comp_in - px->be_counters.comp_out)*100/px->be_counters.comp_in) : 0,
@@ -2645,9 +2645,9 @@ static int stats_dump_be_stats(struct stream_interface *si, struct proxy *px, in
                              "<td class=ac>%s %s</td><td class=ac>&nbsp;</td><td class=ac>%d</td>"
                              "<td class=ac>%d</td><td class=ac>%d</td>"
                              "",
-                             U2H0(px->be_counters.denied_req), U2H1(px->be_counters.denied_resp),
-                             U2H2(px->be_counters.failed_conns),
-                             U2H5(px->be_counters.failed_resp),
+                             U2H(px->be_counters.denied_req), U2H(px->be_counters.denied_resp),
+                             U2H(px->be_counters.failed_conns),
+                             U2H(px->be_counters.failed_resp),
                              px->be_counters.cli_aborts,
                              px->be_counters.srv_aborts,
                              px->be_counters.retries, px->be_counters.redispatches,
index 10c25a3029ef3ebeccc147126571dd6e30072d3e..13ec4ad999e5c48ece91e2af26364254fe3bc50a 100644 (file)
@@ -25,7 +25,7 @@
 #include <common/standard.h>
 #include <eb32tree.h>
 
-/* enough to store 10 integers of :
+/* enough to store NB_ITOA_STR integers of :
  *   2^64-1 = 18446744073709551615 or
  *    -2^63 = -9223372036854775808
  *
@@ -33,7 +33,8 @@
  * '<span class="rls"></span>' around digits at positions 3N+1 in order
  * to add spacing at up to 6 positions : 18 446 744 073 709 551 615
  */
-char itoa_str[10][171];
+char itoa_str[NB_ITOA_STR][171];
+int itoa_idx = 0; /* index of next itoa_str to use */
 
 /*
  * unsigned long long ASCII representation