Skip to content

Commit 03d7329

Browse files
rasifrclaude
authored andcommitted
Fix Codacy false-positive findings and unused variable warnings
Replace strlen(PSWD_KEYWORD) with sizeof(PSWD_KEYWORD) - 1 since PSWD_KEYWORD is a compile-time string literal; evaluated at compile time with no runtime overhead. Remove unused COL_LSN and COL_SNAP variables in spock_create_slot_and_read_progress(); the read_peer_progress result columns 0 and 1 are intentionally skipped in favour of the values already obtained from the replication protocol. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c7e7515 commit 03d7329

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/spock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ log_message_filter(ErrorData *edata)
862862
if (edata->elevel == ERROR)
863863
{
864864
char *strpos;
865-
const int len = strlen(PSWD_KEYWORD);
865+
const int len = sizeof(PSWD_KEYWORD) - 1;
866866

867867
/*
868868
* Password may bubble up in the error message and query string. XXX:

src/spock_sync.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,7 @@ spock_create_slot_and_read_progress(PGconn *conn, PGconn *repl_conn,
579579
List *progress_list = NIL;
580580
int nrows;
581581
int rno;
582-
/* Column indices in the result: lsn(0), snapshot(1), then GP_* + 2 */
583-
const int COL_LSN = 0;
584-
const int COL_SNAP = 1;
582+
/* Column indices in the result: lsn(0), snapshot(1) are skipped; GP_* start at 2 */
585583
const int COL_OFFSET = 2; /* GP_* indices start at COL_OFFSET */
586584

587585
initStringInfo(&query);

0 commit comments

Comments
 (0)