svn commit: r344239 - head/stand/common

Ian Lepore ian at FreeBSD.org
Sun Feb 17 23:38:18 UTC 2019


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;


More information about the svn-src-all mailing list