aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/indent/indent/0001-Remove-dead-paren_level-code.patch
blob: 5a474cf0fcfd290ce82876424ce523cb7a409669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 5af65ce9674a69054c9a8405e51794c6f3ca41df Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 4 Jun 2021 12:34:18 -0700
Subject: [PATCH] Remove dead paren_level code

Local variable `paren_level' in src/output.c:dump_line_code() is
initialized to 0, then incremented with count_parens() return
value, and then the variable is never used. Also count_parens()
has no side effect. Thus this patch removes this useless code.

Upstream-Status: Submitted [https://mail.gnu.org/archive/html/bug-indent/2011-04/msg00000.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/output.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)

diff --git a/src/output.c b/src/output.c
index ee01bcc..5b92167 100644
--- a/src/output.c
+++ b/src/output.c
@@ -798,37 +798,6 @@ static int dump_line_label(void)
    return cur_col;
 }
 
-/**
- *
- */
-
-static int count_parens(
-    const char * string)
-{
-    int paren_level = 0;
-
-    while (*string)
-    {
-        switch (*string)
-        {
-        case '(':
-        case '[':
-            paren_level++;
-            break;
-        case ')':
-        case ']':
-            paren_level--;
-            break;
-        default:
-            break;
-        }
-
-        string++;
-    }
-
-    return paren_level;
-}
-
 /**
  *
  */
@@ -840,8 +809,6 @@ static void dump_line_code(
     BOOLEAN * pbreak_line,
     int       target_col_break)
 {
-   int paren_level   = 0;
-
    if (s_code != e_code)
    {                       /* print code section, if any */
       int i;
@@ -928,8 +895,6 @@ static void dump_line_code(
 
          *pcur_col = count_columns (*pcur_col, s_code, NULL_CHAR);
 
-         paren_level += count_parens(s_code);
-
          s_code[buf_break->offset] = c;
 
          *pnot_truncated = 0;
-- 
2.31.1