[master] be83e3dae cache_hash: split objhead alloc / init

Nils Goroll nils.goroll at uplex.de
Mon Jul 21 13:49:05 UTC 2025


commit be83e3dae8265fdc4c91f11d5778b20ceb4e2479
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Jul 11 11:20:42 2025 +0200

    cache_hash: split objhead alloc / init

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 7b19df12c..6520c0d2f 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -93,17 +93,23 @@ VCF_RETURNS()
 
 /*---------------------------------------------------------------------*/
 
-static struct objhead *
-hsh_newobjhead(void)
+static void
+hsh_initobjhead(struct objhead *oh)
 {
-	struct objhead *oh;
 
-	ALLOC_OBJ(oh, OBJHEAD_MAGIC);
 	XXXAN(oh);
+	INIT_OBJ(oh, OBJHEAD_MAGIC);
 	oh->refcnt = 1;
 	VTAILQ_INIT(&oh->objcs);
 	VTAILQ_INIT(&oh->waitinglist);
 	Lck_New(&oh->mtx, lck_objhdr);
+}
+
+static struct objhead *
+hsh_newobjhead(void)
+{
+	struct objhead *oh = malloc(sizeof *oh);
+	hsh_initobjhead(oh);
 	return (oh);
 }
 


More information about the varnish-commit mailing list