From 15e13b8c6569da733d7d8bb1746a93e95679af00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Tr=C3=A1vn=C3=AD=C4=8Dek?= <jan.travnicek@fit.cvut.cz>
Date: Mon, 27 Dec 2021 20:01:24 +0100
Subject: [PATCH] tidy: remove use of a magic constant

even though here the constant is not magical at all, it makes sense to have auto
here to let the array of escaped and actual special characters easily
extensible. Should that ever be needed.
---
 aql2/src/prompt/ReadlinePromptHistory.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/aql2/src/prompt/ReadlinePromptHistory.cpp b/aql2/src/prompt/ReadlinePromptHistory.cpp
index 9e1cdf264c..e5e95b3faf 100644
--- a/aql2/src/prompt/ReadlinePromptHistory.cpp
+++ b/aql2/src/prompt/ReadlinePromptHistory.cpp
@@ -17,7 +17,7 @@ char * ReadlinePromptHistory::descape ( const char * buffer ) {
 		if ( buffer [ i ] == '\\' ) {
 			++ i;
 			auto find_by_escaped = [ & ] ( const std::pair < char, char > & esc_pair ) { return esc_pair.second == buffer [ i ]; };
-			std::array < std::pair < char, char >, 8 >::const_iterator iter = std::find_if ( esc_char_list.begin ( ), esc_char_list.end ( ), find_by_escaped );
+			auto iter = std::find_if ( esc_char_list.begin ( ), esc_char_list.end ( ), find_by_escaped );
 			if ( iter == esc_char_list.end ( ) ) {
 				free ( dest );
 				return strdup ( buffer );
@@ -41,7 +41,7 @@ char * ReadlinePromptHistory::escape ( const char * buffer){
 
 	for ( size_t i = 0; i < l; ++ i ) {
 		auto find_by_actual = [ & ] ( const std::pair < char, char > & esc_pair ) { return esc_pair.first == buffer [ i ]; };
-		std::array < std::pair < char, char >, 8 >::const_iterator iter = std::find_if ( esc_char_list.begin ( ), esc_char_list.end ( ), find_by_actual );
+		auto iter = std::find_if ( esc_char_list.begin ( ), esc_char_list.end ( ), find_by_actual );
 		if ( iter == esc_char_list.end ( ) ) {
 			* ptr ++ = buffer [ i ];
 		} else {
-- 
GitLab