[master] 20c5f37 Polish
Federico G. Schwindt
fgsch at lodoss.net
Sun Feb 26 00:05:06 CET 2017
commit 20c5f379fd0ee18288dac4b501a0c30c7069a4fa
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Sat Feb 25 22:56:45 2017 +0000
Polish
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 8195094..526ebb3 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -205,8 +205,8 @@ http1_reembark(struct worker *wrk, struct req *req)
static int __match_proto__(vtr_minimal_response_f)
http1_minimal_response(struct req *req, uint16_t status)
{
- size_t wl, l, spc = 80;
- char buf[spc];
+ size_t wl, l;
+ char buf[80];
const char *reason;
assert(status >= 100);
@@ -214,9 +214,9 @@ http1_minimal_response(struct req *req, uint16_t status)
reason = http_Status2Reason(status, NULL);
- l = snprintf(buf, spc,
+ l = snprintf(buf, sizeof(buf),
"HTTP/1.1 %03d %s\r\n\r\n", status, reason);
- assert (l < spc);
+ assert (l < sizeof(buf));
VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1");
VSLb(req->vsl, SLT_RespStatus, "%03d", status);
diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c
index f1d85a8..f987e3c 100644
--- a/bin/varnishd/http1/cache_http1_vfp.c
+++ b/bin/varnishd/http1/cache_http1_vfp.c
@@ -96,7 +96,6 @@ v1f_pull_chunked(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr,
ssize_t *lp)
{
struct http_conn *htc;
- int i;
char buf[20]; /* XXX: 20 is arbitrary */
char *q;
unsigned u;
@@ -171,8 +170,7 @@ v1f_pull_chunked(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr,
return (VFP_OK);
}
AZ(vfe->priv2);
- i = v1f_read(vc, htc, buf, 1);
- if (i <= 0)
+ if (v1f_read(vc, htc, buf, 1) <= 0)
return (VFP_Error(vc, "chunked read err"));
if (buf[0] == '\r' && v1f_read(vc, htc, buf, 1) <= 0)
return (VFP_Error(vc, "chunked read err"));
diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index ef45943..7682a31 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -121,9 +121,8 @@ int __match_proto__(vtr_minimal_response_f)
h2_minimal_response(struct req *req, uint16_t status)
{
struct h2_req *r2;
- const size_t spc = 6;
size_t l;
- uint8_t buf[spc];
+ uint8_t buf[6];
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CAST_OBJ_NOTNULL(r2, req->transport_priv, H2_REQ_MAGIC);
@@ -132,7 +131,7 @@ h2_minimal_response(struct req *req, uint16_t status)
assert(status < 1000);
l = h2_status(buf, status);
- assert(l < spc);
+ assert(l < sizeof(buf));
VSLb(req->vsl, SLT_RespProtocol, "HTTP/2.0");
VSLb(req->vsl, SLT_RespStatus, "%03d", status);
More information about the varnish-commit
mailing list