public inbox for [email protected]
help / color / mirror / Atom feedFrom: Yuto Sasaki (Fujitsu) <[email protected]>
To: [email protected] <[email protected]>
Subject: ECPG Refactor: move sqlca variable in ecpg_log()
Date: Thu, 10 Oct 2024 02:04:28 +0000
Message-ID: <TY2PR01MB3628A85689649BABC9A1C6C3C1782@TY2PR01MB3628.jpnprd01.prod.outlook.com> (raw)
The sqlca variable in the ecpg_log() was declared with an unnecessarily wide
scope, so I moved to the appropriate place.
Please see attached.
Attachments:
[application/octet-stream] scope.diff (925B, ../TY2PR01MB3628A85689649BABC9A1C6C3C1782@TY2PR01MB3628.jpnprd01.prod.outlook.com/3-scope.diff)
download | inline diff:
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 2ae989e3e5..f2d277dfec 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -232,7 +232,6 @@ void
ecpg_log(const char *format,...)
{
va_list ap;
- struct sqlca_t *sqlca = ECPGget_sqlca();
const char *intl_format;
int bufsize;
char *fmt;
@@ -272,10 +271,14 @@ ecpg_log(const char *format,...)
va_end(ap);
/* dump out internal sqlca variables */
- if (ecpg_internal_regression_mode && sqlca != NULL)
+ if (ecpg_internal_regression_mode)
{
- fprintf(debugstream, "[NO_PID]: sqlca: code: %ld, state: %s\n",
- sqlca->sqlcode, sqlca->sqlstate);
+ struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca != NULL)
+ {
+ fprintf(debugstream, "[NO_PID]: sqlca: code: %ld, state: %s\n",
+ sqlca->sqlcode, sqlca->sqlstate);
+ }
}
fflush(debugstream);
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: ECPG Refactor: move sqlca variable in ecpg_log()
In-Reply-To: <TY2PR01MB3628A85689649BABC9A1C6C3C1782@TY2PR01MB3628.jpnprd01.prod.outlook.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox