[master] 91abe0a53 sess: Polish HTC_RxPipeline()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Aug 20 14:51:05 UTC 2021


commit 91abe0a534d9fd7c86faf2b19b2e04cd1d334fbf
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Jul 8 08:45:37 2021 +0200

    sess: Polish HTC_RxPipeline()
    
    All call sites pass a non-null char pointer.

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 51d10b417..f8215dc13 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -244,16 +244,16 @@ HTC_RxInit(struct http_conn *htc, struct ws *ws)
 }
 
 void
-HTC_RxPipeline(struct http_conn *htc, void *p)
+HTC_RxPipeline(struct http_conn *htc, char *p)
 {
 
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
-	if (p == NULL || (char*)p == htc->rxbuf_e) {
+	assert(p >= htc->rxbuf_b);
+	assert(p <= htc->rxbuf_e);
+	if (p == htc->rxbuf_e) {
 		htc->pipeline_b = NULL;
 		htc->pipeline_e = NULL;
 	} else {
-		assert((char*)p >= htc->rxbuf_b);
-		assert((char*)p < htc->rxbuf_e);
 		htc->pipeline_b = p;
 		htc->pipeline_e = htc->rxbuf_e;
 	}
diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index b150ea5e0..f9236cf0e 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -432,7 +432,7 @@ void SES_Rel(struct sess *sp);
 
 const char * HTC_Status(enum htc_status_e);
 void HTC_RxInit(struct http_conn *htc, struct ws *ws);
-void HTC_RxPipeline(struct http_conn *htc, void *);
+void HTC_RxPipeline(struct http_conn *htc, char *);
 enum htc_status_e HTC_RxStuff(struct http_conn *, htc_complete_f *,
     vtim_real *t1, vtim_real *t2, vtim_real ti, vtim_real tn, vtim_dur td,
     int maxbytes);


More information about the varnish-commit mailing list