Skip to content

Commit 6898e5c

Browse files
OreoYangclaude
andcommitted
fix: correct typos and improve code quality in ivy_guc.c
Fixed typos ("blow"->"below", "charater"->"character", etc.), corrected grammar ("whether enable"->"whether to enable"), removed redundant null terminator assignments, replaced unsafe memcpy with strcpy for null termination safety, and replaced goto statements with recursive calls. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5acc6bb commit 6898e5c

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

src/backend/utils/misc/ivy_guc.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int rowid_seq_cache = 20;
5656

5757
#ifdef IVY_GUC_VAR_STRUCT
5858

59-
/* The comments shown as blow define the
59+
/* The comments shown as below define the
6060
* value range of guc parameters "database_mode"
6161
* and "compatible_db".
6262
*/
@@ -72,7 +72,6 @@ static const struct config_enum_entry db_parser_options[] = {
7272
{"pg", PG_PARSER, false},
7373
{"oracle", ORA_PARSER, false},
7474
{NULL, 0, false}
75-
7675
};
7776

7877

@@ -126,7 +125,7 @@ static struct config_bool Ivy_ConfigureNamesBool[] =
126125
},
127126
{
128127
{"ivorysql.enable_case_switch", PGC_USERSET, CLIENT_CONN_STATEMENT,
129-
gettext_noop("whether enable case conversion feature in oracle compatible mode."),
128+
gettext_noop("whether to enable case conversion feature in oracle compatible mode."),
130129
NULL,
131130
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
132131
},
@@ -137,7 +136,7 @@ static struct config_bool Ivy_ConfigureNamesBool[] =
137136

138137
{
139138
{"ivorysql.enable_emptystring_to_NULL", PGC_USERSET, COMPAT_ORACLE_OPTIONS,
140-
gettext_noop("whether convert empty string to NULL."),
139+
gettext_noop("whether to convert empty string to NULL."),
141140
NULL
142141
},
143142
&enable_emptystring_to_NULL,
@@ -233,7 +232,7 @@ static struct config_int Ivy_ConfigureNamesInt[] =
233232

234233
{
235234
{"ivorysql.port", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
236-
gettext_noop("Sets the Oracle TCP port the server listens on."),
235+
gettext_noop("Sets the Oracle TCP port that the server listens on."),
237236
NULL
238237
},
239238
&OraPortNumber,
@@ -369,7 +368,7 @@ static struct config_real Ivy_ConfigureNamesReal[] =
369368
{
370369
#endif
371370
#ifdef IVY_GUC_REAL_PARAMS
372-
/* Add real guc param at here */
371+
/* Add real guc param here */
373372

374373
#endif
375374
#if 0
@@ -420,7 +419,7 @@ static struct config_enum Ivy_ConfigureNamesEnum[] =
420419

421420
{
422421
{"nls_length_semantics", PGC_USERSET, COMPAT_ORACLE_OPTIONS,
423-
gettext_noop("Compatible Oracle NLS parameter for charater data type."),
422+
gettext_noop("Compatible Oracle NLS parameter for character data type."),
424423
gettext_noop("Valid values are CHAR, BYTE."),
425424
GUC_IS_NAME | GUC_NOT_IN_SAMPLE
426425
},
@@ -477,7 +476,7 @@ check_compatible_mode(int *newval, void **extra, GucSource source)
477476
ereport(ERROR,
478477
(errcode(ERRCODE_SYSTEM_ERROR),
479478
errmsg("IVORYSQL_ORA library not found!"),
480-
errhint("You must load IVORYSQL_ORA to use oracle parser..")));
479+
errhint("You must load IVORYSQL_ORA to use oracle parser.")));
481480
}
482481
}
483482
return true;
@@ -530,20 +529,17 @@ nls_case_conversion(char **param, char type)
530529
{
531530
char *p;
532531

533-
CASE_CONVERSION:
534532
if (type == 'u')
535533
{
536534
for (p = *param; p < *param + strlen(*param); ++p)
537535
if (97 <= *p && *p <= 122)
538536
*p -= 32;
539-
*p = '\0';
540537
}
541538
else if (type == 'l')
542539
{
543540
for (p = *param; p < *param + strlen(*param); ++p)
544541
if (65 <= *p && *p <= 90)
545542
*p += 32;
546-
*p = '\0';
547543
}
548544
else if (type == 'b')
549545
{
@@ -562,13 +558,11 @@ nls_case_conversion(char **param, char type)
562558

563559
if (has_upper && !has_lower)
564560
{
565-
type = 'l';
566-
goto CASE_CONVERSION;
561+
nls_case_conversion(param, 'l');
567562
}
568563
else if (!has_upper && has_lower)
569564
{
570-
type = 'u';
571-
goto CASE_CONVERSION;
565+
nls_case_conversion(param, 'u');
572566
}
573567
}
574568
}
@@ -597,9 +591,9 @@ nls_territory_check(char **newval, void **extra, GucSource source)
597591
&& (IsNormalProcessingMode() || (IsUnderPostmaster && MyProcPort)))
598592
{
599593
if (pg_strcasecmp(*newval, "CHINA") == 0)
600-
memcpy(*newval, "CHINA", 5);
594+
strcpy(*newval, "CHINA");
601595
else if (pg_strcasecmp(*newval, "AMERICA") == 0)
602-
memcpy(*newval, "AMERICA", 7);
596+
strcpy(*newval, "AMERICA");
603597
else
604598
ereport(ERROR, (errmsg("Cannot access NLS data files "
605599
"or invalid environment specified")));

0 commit comments

Comments
 (0)