v2-0012-cleanup-avoid-local-variables-shadowed-by-globals.patch

application/octet-stream

Filename: v2-0012-cleanup-avoid-local-variables-shadowed-by-globals.patch
Type: application/octet-stream
Part: 12
Message: Re: Cleanup shadows variable warnings, round 1

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v2-0012
Subject: cleanup: avoid local variables shadowed by globals in ecpg.header
File+
src/interfaces/ecpg/preproc/ecpg.header 6 6
From e72575d67fb2360ff047cd091ecc06d1e0696096 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Wed, 3 Dec 2025 07:40:26 +0800
Subject: [PATCH v2 12/13] cleanup: avoid local variables shadowed by globals
 in ecpg.header

This commit renames local variables in ecpg.header that were shadowed by
global identifiers of the same names. The updated local names ensure the
identifiers remain distinct and unambiguous within the file.

Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com
---
 src/interfaces/ecpg/preproc/ecpg.header | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header
index dde69a39695..a58dda32f48 100644
--- a/src/interfaces/ecpg/preproc/ecpg.header
+++ b/src/interfaces/ecpg/preproc/ecpg.header
@@ -178,7 +178,7 @@ create_questionmarks(const char *name, bool array)
 }
 
 static char *
-adjust_outofscope_cursor_vars(struct cursor *cur)
+adjust_outofscope_cursor_vars(struct cursor *pcur)
 {
 	/*
 	 * Informix accepts DECLARE with variables that are out of scope when OPEN
@@ -203,7 +203,7 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
 		struct variable *newvar,
 				   *newind;
 
-		list = (insert ? cur->argsinsert : cur->argsresult);
+		list = (insert ? pcur->argsinsert : pcur->argsresult);
 
 		for (ptr = list; ptr != NULL; ptr = ptr->next)
 		{
@@ -434,9 +434,9 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
 		}
 
 		if (insert)
-			cur->argsinsert_oos = newlist;
+			pcur->argsinsert_oos = newlist;
 		else
-			cur->argsresult_oos = newlist;
+			pcur->argsresult_oos = newlist;
 	}
 
 	return result;
@@ -490,7 +490,7 @@ static void
 add_typedef(const char *name, const char *dimension, const char *length,
 			enum ECPGttype type_enum,
 			const char *type_dimension, const char *type_index,
-			int initializer, int array)
+			int initial_value, int array)
 {
 	/* add entry to list */
 	struct typedefs *ptr,
@@ -498,7 +498,7 @@ add_typedef(const char *name, const char *dimension, const char *length,
 
 	if ((type_enum == ECPGt_struct ||
 		 type_enum == ECPGt_union) &&
-		initializer == 1)
+		initial_value == 1)
 		mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
 	else if (INFORMIX_MODE && strcmp(name, "string") == 0)
 		mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
-- 
2.39.5 (Apple Git-154)