]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: unexpand: remove dead store
authorDr. David Alan Gilbert <dave@treblig.org>
Fri, 30 Jan 2026 00:41:09 +0000 (00:41 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 6 Feb 2026 14:43:24 +0000 (14:43 +0000)
The assign to next_tab_column in the backspace branch is never
read; in fact it's always written and then read solely inside the
blank branch.

Move the declaration of 'next_tab_column' down into the blank
branch, and remove its assignment in the backspace branch.

Spotted by the 'infer' static checker.

* src/unexpand.c (unexpand): Remove dead store of next_tab_column.

src/unexpand.c

index b92a9517a13297e02b6eaf90f9a786e98f2a1e29..54b3ae2fe2b9d8b0c2dd03cc8d89455f75abb9ca 100644 (file)
@@ -140,9 +140,6 @@ unexpand (void)
       /* Column of next input character.  */
       colno column = 0;
 
-      /* Column the next input tab stop is on.  */
-      colno next_tab_column = 0;
-
       /* Index in TAB_LIST of next tab stop to examine.  */
       idx_t tab_index = 0;
 
@@ -173,8 +170,10 @@ unexpand (void)
                 {
                   bool last_tab;
 
-                  next_tab_column = get_next_tab_column (column, &tab_index,
-                                                         &last_tab);
+                  /* Column the next input tab stop is on.  */
+                  colno next_tab_column = get_next_tab_column (column,
+                                                               &tab_index,
+                                                               &last_tab);
 
                   if (last_tab)
                     convert = false;
@@ -217,7 +216,6 @@ unexpand (void)
                   /* Go back one column, and force recalculation of the
                      next tab stop.  */
                   column -= !!column;
-                  next_tab_column = column;
                   tab_index -= !!tab_index;
                 }
               else