Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2019 23:38:17 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344239 - head/stand/common
Message-ID:  <201902172338.x1HNcHhq061983@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun Feb 17 23:38:17 2019
New Revision: 344239
URL: https://svnweb.freebsd.org/changeset/base/344239

Log:
  Use a couple local variables to avoid repetitive long expressions that
  cause line-wrapping.

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==============================================================================
--- head/stand/common/disk.c	Sun Feb 17 23:32:09 2019	(r344238)
+++ head/stand/common/disk.c	Sun Feb 17 23:38:17 2019	(r344239)
@@ -112,15 +112,18 @@ ptable_print(void *arg, const char *pname, const struc
 	struct ptable *table;
 	char line[80];
 	int res;
+	u_int sectsize;
+	uint64_t partsize;
 
 	pa = (struct print_args *)arg;
 	od = (struct open_disk *)pa->dev->dd.d_opendata;
+	sectsize = od->sectorsize;
+	partsize = part->end - part->start + 1;
 	sprintf(line, "  %s%s: %s", pa->prefix, pname,
 	    parttype2str(part->type));
 	if (pa->verbose)
 		sprintf(line, "%-*s%s", PWIDTH, line,
-		    display_size(part->end - part->start + 1,
-		    od->sectorsize));
+		    display_size(partsize, sectsize));
 	strcat(line, "\n");
 	if (pager_output(line))
 		return 1;
@@ -131,8 +134,7 @@ ptable_print(void *arg, const char *pname, const struc
 		dev.dd.d_unit = pa->dev->dd.d_unit;
 		dev.d_slice = part->index;
 		dev.d_partition = -1;
-		if (disk_open(&dev, part->end - part->start + 1,
-		    od->sectorsize) == 0) {
+		if (disk_open(&dev, partsize, sectsize) == 0) {
 			/*
 			 * disk_open() for partition -1 on a bsd slice assumes
 			 * you want the first bsd partition.  Reset things so
@@ -140,8 +142,7 @@ ptable_print(void *arg, const char *pname, const struc
 			 */
 			dev.d_partition = -1;
 			dev.d_offset = part->start;
-			table = ptable_open(&dev, part->end - part->start + 1,
-			    od->sectorsize, ptblread);
+			table = ptable_open(&dev, partsize, sectsize, ptblread);
 			if (table != NULL) {
 				sprintf(line, "  %s%s", pa->prefix, pname);
 				bsd.dev = pa->dev;



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