[master] 2c20289 Assert polishing

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 21 12:34:32 CEST 2015


commit 2c20289d60bf2d3db4d82951181b86dccef9e3dd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 21 10:34:11 2015 +0000

    Assert polishing

diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 57e06b8..7413329 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -52,7 +52,6 @@ obj_getmethods(const struct objcore *oc)
 {
 
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
-	AN(oc->stobj->stevedore);
 	CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC);
 	AN(oc->stobj->stevedore->methods);
 	return (oc->stobj->stevedore->methods);
@@ -61,10 +60,11 @@ obj_getmethods(const struct objcore *oc)
 static struct object *
 obj_getobj(struct worker *wrk, struct objcore *oc)
 {
-	const struct storeobj_methods *m = obj_getmethods(oc);
+	const struct storeobj_methods *m;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+	m = obj_getmethods(oc);
 	AN(m->getobj);
 	return (m->getobj(wrk, oc));
 }
diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c
index 3a5698d..6d5c771 100644
--- a/bin/varnishd/storage/storage_persistent_silo.c
+++ b/bin/varnishd/storage/storage_persistent_silo.c
@@ -396,11 +396,12 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc)
 	uint64_t l;
 	int bad;
 
-	/* Some calls are direct, but they should match anyway */
-	assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj);
-
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
+	AN(oc->stobj->stevedore);
+
+	/* Some calls are direct, but they should match anyway */
+	assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj);
 
 	CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC);
 	so = smp_find_so(sg, oc->stobj->priv2);



More information about the varnish-commit mailing list