The branch main has been updated by dchagin:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=901b050b36b991a9399acfb9c3eeb33704c5af03

commit 901b050b36b991a9399acfb9c3eeb33704c5af03
Author:     Dmitry Chagin <[email protected]>
AuthorDate: 2023-02-07 07:43:18 +0000
Commit:     Dmitry Chagin <[email protected]>
CommitDate: 2023-02-07 07:43:18 +0000

    bsdlabel: Remove a write-only variable.
    
    Since r149061 (2005) the total_size variable is write-only.
    
    Differential Revision:  https://reviews.freebsd.org/D38368
    MFC after:              2 weeks
---
 sbin/bsdlabel/bsdlabel.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index 943f37207fc2..efe7eebf23c6 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -1094,7 +1094,7 @@ checklabel(struct disklabel *lp)
        struct partition *pp;
        int i, errors = 0;
        char part;
-       u_long base_offset, needed, total_size, total_percent, current_offset;
+       u_long base_offset, needed, total_percent, current_offset;
        long free_space;
        int seen_default_offset;
        int hog_part;
@@ -1173,7 +1173,6 @@ checklabel(struct disklabel *lp)
 
 
        /* first allocate space to the partitions, then offsets */
-       total_size = 0; /* in sectors */
        total_percent = 0; /* in percent */
        hog_part = -1;
        /* find all fixed partitions */
@@ -1234,9 +1233,6 @@ checklabel(struct disklabel *lp)
                                                size /= lp->d_secsize;
                                                pp->p_size = size;
                                        }
-                                       /* else already in sectors */
-                                       if (i != RAW_PART)
-                                               total_size += size;
                                }
                        }
                }
@@ -1272,7 +1268,6 @@ checklabel(struct disklabel *lp)
                                if (part_set[i] && part_size_type[i] == '%') {
                                        /* careful of overflows! and integer 
roundoff */
                                        pp->p_size = ((double)pp->p_size/100) * 
free_space;
-                                       total_size += pp->p_size;
 
                                        /* FIX we can lose a sector or so due 
to roundoff per
                                           partition.  A more complex algorithm 
could avoid that */
@@ -1328,7 +1323,6 @@ checklabel(struct disklabel *lp)
                } else {
                        lp->d_partitions[hog_part].p_size = current_offset -
                            base_offset - needed;
-                       total_size += lp->d_partitions[hog_part].p_size;
                }
        }
 

Reply via email to