From 65d6c06a91ce5decaab46a4a3db74cace4e37cb8 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 20 Nov 2002 18:10:42 +0000 Subject: [PATCH] Do not call the dumpconf method unless there is one. Compare pointers with NULL. Partially submitted by: Christian Carstensen Approved by: re --- sys/geom/geom_dump.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index 7e4ce37253a9..95a9ffd9d239 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -126,7 +126,8 @@ g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int level) LIST_FOREACH(pp, &gp->provider, provider) { sbuf_printf(sb, "%d %s %s %ju %u", level, gp->class->name, pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); - gp->dumpconf(sb, NULL, gp, NULL, pp); + if (gp->dumpconf != NULL) + gp->dumpconf(sb, NULL, gp, NULL, pp); sbuf_printf(sb, "\n"); LIST_FOREACH(cp, &pp->consumers, consumers) g_conftxt_geom(sb, cp->geom, level + 1); @@ -170,7 +171,7 @@ g_conf_consumer(struct sbuf *sb, struct g_consumer *cp) sbuf_printf(sb, "\t \n", cp->provider); sbuf_printf(sb, "\t r%dw%de%d\n", cp->acr, cp->acw, cp->ace); - if (cp->geom->dumpconf) { + if (cp->geom->dumpconf != NULL) { sbuf_printf(sb, "\t \n"); cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); sbuf_printf(sb, "\t \n"); @@ -190,7 +191,7 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp) sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); - if (pp->geom->dumpconf) { + if (pp->geom->dumpconf != NULL) { sbuf_printf(sb, "\t \n"); pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); sbuf_printf(sb, "\t \n"); @@ -209,7 +210,7 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_ sbuf_printf(sb, " \n", gp->class); sbuf_printf(sb, " %s\n", gp->name); sbuf_printf(sb, " %d\n", gp->rank); - if (gp->dumpconf) { + if (gp->dumpconf != NULL) { sbuf_printf(sb, " \n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); sbuf_printf(sb, " \n");