From owner-svn-src-all@FreeBSD.ORG Fri Jan 22 08:51:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6EF91065672; Fri, 22 Jan 2010 08:51:58 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C29A8FC16; Fri, 22 Jan 2010 08:51:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0M8pwUY011733; Fri, 22 Jan 2010 08:51:58 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0M8pwCI011730; Fri, 22 Jan 2010 08:51:58 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201001220851.o0M8pwCI011730@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 22 Jan 2010 08:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202784 - head/sbin/mdconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2010 08:51:58 -0000 Author: jh Date: Fri Jan 22 08:51:58 2010 New Revision: 202784 URL: http://svn.freebsd.org/changeset/base/202784 Log: Make mdconfig(8) WARNS=6 clean: - Constify geom_config_get() name argument. - Add void keyword for usage(). - Initialize mdunit to NULL. - Don't call md_prthumanval() at all if length is NULL. Approved by: trasz (mentor) Modified: head/sbin/mdconfig/Makefile head/sbin/mdconfig/mdconfig.c Modified: head/sbin/mdconfig/Makefile ============================================================================== --- head/sbin/mdconfig/Makefile Fri Jan 22 08:45:12 2010 (r202783) +++ head/sbin/mdconfig/Makefile Fri Jan 22 08:51:58 2010 (r202784) @@ -4,7 +4,6 @@ PROG= mdconfig MAN= mdconfig.8 MLINKS= mdconfig.8 vnconfig.8 -WARNS?= 2 DPADD= ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} LDADD= -lutil -lgeom -lbsdxml -lsbuf Modified: head/sbin/mdconfig/mdconfig.c ============================================================================== --- head/sbin/mdconfig/mdconfig.c Fri Jan 22 08:45:12 2010 (r202783) +++ head/sbin/mdconfig/mdconfig.c Fri Jan 22 08:51:58 2010 (r202784) @@ -41,7 +41,7 @@ static void usage(void); static int md_find(char *, const char *); static int md_query(char *name); static int md_list(char *units, int opt); -static char *geom_config_get(struct gconf *g, char *name); +static char *geom_config_get(struct gconf *g, const char *name); static void md_prthumanval(char *length); #define OPT_VERBOSE 0x01 @@ -52,7 +52,7 @@ static void md_prthumanval(char *length) #define CLASS_NAME_MD "MD" static void -usage() +usage(void) { fprintf(stderr, "usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n" @@ -74,7 +74,7 @@ main(int argc, char **argv) int ch, fd, i, vflag; char *p; int cmdline = 0; - char *mdunit; + char *mdunit = NULL; bzero(&mdio, sizeof(mdio)); mdio.md_file = malloc(PATH_MAX); @@ -379,10 +379,9 @@ md_list(char *units, int opt) if (strcmp(type, "vnode") == 0) file = geom_config_get(gc, "file"); length = geom_config_get(gc, "length"); - if (length == NULL) - length = ""; printf("\t%s\t", type); - md_prthumanval(length); + if (length != NULL) + md_prthumanval(length); if (file != NULL) { printf("\t%s", file); file = NULL; @@ -409,7 +408,7 @@ md_list(char *units, int opt) * Returns value of 'name' from gconfig structure. */ static char * -geom_config_get(struct gconf *g, char *name) +geom_config_get(struct gconf *g, const char *name) { struct gconfig *gce;