From 0c45d26a285d109741c8a08e4709bd6c84752bca Mon Sep 17 00:00:00 2001 From: laurens Date: Wed, 13 Nov 2019 00:03:52 +0100 Subject: [PATCH] Rename total_levels to total_pairs - We are counting pairs of braces, not levels of indentation --- lib/cmock_header_parser.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cmock_header_parser.rb b/lib/cmock_header_parser.rb index fdf005f..d47b539 100644 --- a/lib/cmock_header_parser.rb +++ b/lib/cmock_header_parser.rb @@ -78,12 +78,12 @@ class CMockHeaderParser def count_number_of_pairs_of_braces_in_function(source) is_function_start_found = false curr_level = 0 - total_levels = 0 + total_pairs = 0 source.each_char do |c| if ("{" == c) curr_level += 1 - total_levels +=1 + total_pairs +=1 is_function_start_found = true elsif ("}" == c) curr_level -=1 @@ -93,10 +93,10 @@ class CMockHeaderParser end if 0 != curr_level - total_levels = 0 # Something is fishy about this source, not enough closing braces? + total_pairs = 0 # Something is fishy about this source, not enough closing braces? end - return total_levels + return total_pairs end # Transform inline functions to regular functions in the source by the user