Do not call the dumpconf method unless there is one.

Compare pointers with NULL.

Partially submitted by:	Christian Carstensen <cc@gate5.de>
Approved by:	re
This commit is contained in:
phk 2002-11-20 18:10:42 +00:00
parent 15c7fa3d74
commit 65d6c06a91

View File

@ -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 <provider ref=\"%p\"/>\n", cp->provider);
sbuf_printf(sb, "\t <mode>r%dw%de%d</mode>\n",
cp->acr, cp->acw, cp->ace);
if (cp->geom->dumpconf) {
if (cp->geom->dumpconf != NULL) {
sbuf_printf(sb, "\t <config>\n");
cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL);
sbuf_printf(sb, "\t </config>\n");
@ -190,7 +191,7 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp)
sbuf_printf(sb, "\t <mediasize>%jd</mediasize>\n",
(intmax_t)pp->mediasize);
sbuf_printf(sb, "\t <sectorsize>%u</sectorsize>\n", pp->sectorsize);
if (pp->geom->dumpconf) {
if (pp->geom->dumpconf != NULL) {
sbuf_printf(sb, "\t <config>\n");
pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp);
sbuf_printf(sb, "\t </config>\n");
@ -209,7 +210,7 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_
sbuf_printf(sb, " <class ref=\"%p\"/>\n", gp->class);
sbuf_printf(sb, " <name>%s</name>\n", gp->name);
sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank);
if (gp->dumpconf) {
if (gp->dumpconf != NULL) {
sbuf_printf(sb, " <config>\n");
gp->dumpconf(sb, "\t", gp, NULL, NULL);
sbuf_printf(sb, " </config>\n");