Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jul 2013 23:53:22 +0000 (UTC)
From:      Peter Grehan <grehan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252494 - head/usr.sbin/bhyve
Message-ID:  <201307012353.r61NrMb1005346@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grehan
Date: Mon Jul  1 23:53:22 2013
New Revision: 252494
URL: http://svnweb.freebsd.org/changeset/base/252494

Log:
  Fix up option parsing to allow a colon in the config section.
  Clean up some other unnecessary code.
  
  Submitted by:	Dinakar Medavaram    dinnu sun at gmail
  Reviewed by:	neel

Modified:
  head/usr.sbin/bhyve/pci_emul.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==============================================================================
--- head/usr.sbin/bhyve/pci_emul.c	Mon Jul  1 23:12:59 2013	(r252493)
+++ head/usr.sbin/bhyve/pci_emul.c	Mon Jul  1 23:53:22 2013	(r252494)
@@ -140,20 +140,15 @@ pci_parse_slot(char *opt, int legacy)
 	error = -1;
 	str = cpy = strdup(opt);
 
-	config = NULL;
-
-	if (strchr(str, ':') != NULL) {
-		slot = strsep(&str, ":");
-		func = strsep(&str, ",");
-	} else {
-		slot = strsep(&str, ",");
-		func = NULL;
-	}
-
+        slot = strsep(&str, ",");
+        func = NULL;
+        if (strchr(slot, ':') != NULL) {
+		func = cpy;
+		(void) strsep(&func, ":");
+        }
+	
 	emul = strsep(&str, ",");
-	if (str != NULL) {
-		config = strsep(&str, ",");
-	}
+	config = str;
 
 	if (emul == NULL) {
 		pci_parse_slot_usage(opt);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307012353.r61NrMb1005346>