1From 5af65ce9674a69054c9a8405e51794c6f3ca41df Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 4 Jun 2021 12:34:18 -0700
4Subject: [PATCH] Remove dead paren_level code
5
6Local variable `paren_level' in src/output.c:dump_line_code() is
7initialized to 0, then incremented with count_parens() return
8value, and then the variable is never used. Also count_parens()
9has no side effect. Thus this patch removes this useless code.
10
11Upstream-Status: Submitted [https://mail.gnu.org/archive/html/bug-indent/2011-04/msg00000.html]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/output.c | 35 -----------------------------------
15 1 file changed, 35 deletions(-)
16
17diff --git a/src/output.c b/src/output.c
18index ee01bcc..5b92167 100644
19--- a/src/output.c
20+++ b/src/output.c
21@@ -798,37 +798,6 @@ static int dump_line_label(void)
22    return cur_col;
23 }
24
25-/**
26- *
27- */
28-
29-static int count_parens(
30-    const char * string)
31-{
32-    int paren_level = 0;
33-
34-    while (*string)
35-    {
36-        switch (*string)
37-        {
38-        case '(':
39-        case '[':
40-            paren_level++;
41-            break;
42-        case ')':
43-        case ']':
44-            paren_level--;
45-            break;
46-        default:
47-            break;
48-        }
49-
50-        string++;
51-    }
52-
53-    return paren_level;
54-}
55-
56 /**
57  *
58  */
59@@ -840,8 +809,6 @@ static void dump_line_code(
60     BOOLEAN * pbreak_line,
61     int       target_col_break)
62 {
63-   int paren_level   = 0;
64-
65    if (s_code != e_code)
66    {                       /* print code section, if any */
67       int i;
68@@ -928,8 +895,6 @@ static void dump_line_code(
69
70          *pcur_col = count_columns (*pcur_col, s_code, NULL_CHAR);
71
72-         paren_level += count_parens(s_code);
73-
74          s_code[buf_break->offset] = c;
75
76          *pnot_truncated = 0;
77--
782.31.1
79
80