Skip to content

Commit 1304c88

Browse files
committed
Minor style fixes
1 parent 03a3fb8 commit 1304c88

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

src/backup.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void write_backup_file_list(parray *files, const char *root);
105105
static void wait_wal_lsn(XLogRecPtr lsn, bool wait_prev_segment);
106106
static void wait_replica_wal_lsn(XLogRecPtr lsn, bool is_start_backup);
107107
static void make_pagemap_from_ptrack(parray *files);
108-
static void StreamLog(void *arg);
108+
static void *StreamLog(void *arg);
109109

110110
static void get_remote_pgdata_filelist(parray *files);
111111
static void ReceiveFileList(parray* files, PGconn *conn, PGresult *res, int rownum);
@@ -599,8 +599,7 @@ do_backup_instance(void)
599599
/* By default there are some error */
600600
stream_thread_arg.ret = 1;
601601

602-
pthread_create(&stream_thread, NULL, (void *(*)(void *)) StreamLog,
603-
&stream_thread_arg);
602+
pthread_create(&stream_thread, NULL, StreamLog, &stream_thread_arg);
604603
}
605604

606605
/* initialize backup list */
@@ -1051,8 +1050,7 @@ confirm_block_size(const char *name, int blcksz)
10511050
"%s(%d) is not compatible(%d expected)",
10521051
name, block_size, blcksz);
10531052

1054-
PQclear(res);//bad pointer to endp
1055-
1053+
PQclear(res);
10561054
}
10571055

10581056
/*
@@ -2539,7 +2537,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
25392537
/*
25402538
* Start the log streaming
25412539
*/
2542-
static void
2540+
static void *
25432541
StreamLog(void *arg)
25442542
{
25452543
XLogRecPtr startpos;
@@ -2613,6 +2611,8 @@ StreamLog(void *arg)
26132611

26142612
PQfinish(stream_arg->conn);
26152613
stream_arg->conn = NULL;
2614+
2615+
return NULL;
26162616
}
26172617

26182618
/*

src/configure.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ writeBackupCatalogConfig(FILE *out, pgBackupConfig *config)
132132

133133
fprintf(out, "#Backup instance info\n");
134134
fprintf(out, "PGDATA = %s\n", config->pgdata);
135-
//fprintf(out, "system-identifier = %li\n", config->system_identifier);
136-
fprintf(out, "system-identifier = %" INT64_MODIFIER "u\n", config->system_identifier);
135+
fprintf(out, "system-identifier = " UINT64_FORMAT "\n", config->system_identifier);
137136

138137
fprintf(out, "#Connection parameters:\n");
139138
if (config->pgdatabase)

src/dir.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,9 @@ static void dir_list_file_internal(parray *files, const char *root,
100100
int
101101
dir_create_dir(const char *dir, mode_t mode)
102102
{
103-
char copy[MAXPGPATH];
104-
char *parent;
103+
char parent[MAXPGPATH];
105104

106-
strncpy(copy, dir, MAXPGPATH);
107-
108-
parent = pstrdup(dir);
105+
strncpy(parent, dir, MAXPGPATH);
109106
get_parent_directory(parent);
110107

111108
/* Create parent first */
@@ -120,7 +117,6 @@ dir_create_dir(const char *dir, mode_t mode)
120117
elog(ERROR, "cannot create directory \"%s\": %s", dir, strerror(errno));
121118
}
122119

123-
pfree(parent);
124120
return 0;
125121
}
126122

@@ -155,7 +151,7 @@ pgFileInit(const char *path)
155151

156152
file = (pgFile *) pgut_malloc(sizeof(pgFile));
157153

158-
file->name = 0;
154+
file->name = NULL;
159155

160156
file->size = 0;
161157
file->mode = 0;

src/restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
9292
int dest_backup_index = 0;
9393
int base_full_backup_index = 0;
9494
int corrupted_backup_index = 0;
95-
char *action = is_restore ? "Restore":"Validate";
95+
char *action = is_restore ? "Restore":"Validate";
9696

9797
if (is_restore)
9898
{

src/utils/logger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ open_logfile(FILE **file, const char *filename_format)
562562
{
563563
char buf[1024];
564564

565-
control_file = fopen(control, PG_BINARY_R);
565+
control_file = fopen(control, "r");
566566
if (control_file == NULL)
567567
elog_stderr(ERROR, "cannot open rotation file \"%s\": %s",
568568
control, strerror(errno));
@@ -608,7 +608,7 @@ open_logfile(FILE **file, const char *filename_format)
608608
{
609609
time_t timestamp = time(NULL);
610610

611-
control_file = fopen(control, PG_BINARY_W);
611+
control_file = fopen(control, "w");
612612
if (control_file == NULL)
613613
elog_stderr(ERROR, "cannot open rotation file \"%s\": %s",
614614
control, strerror(errno));

src/utils/pgut.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ longopts_to_optstring(const struct option opts[], const size_t len)
989989
s = result;
990990
for (i = 0; i < len; i++)
991991
{
992-
if (!isprint(opts[i].val)) //opts[i].val > 128 ||
992+
if (!isprint(opts[i].val))
993993
continue;
994994
*s++ = opts[i].val;
995995
if (opts[i].has_arg != no_argument)
@@ -1046,7 +1046,6 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
10461046
struct option *longopts;
10471047
size_t len;
10481048

1049-
10501049
len = option_length(options);
10511050
longopts = pgut_newarray(struct option, len + 1);
10521051
option_copy(longopts, options, len);
@@ -1221,7 +1220,7 @@ get_next_token(const char *src, char *dst, const char *line)
12211220
}
12221221
else
12231222
{
1224-
i = j = strcspn(s, "#\n\r\t\v");//removed space
1223+
i = j = strcspn(s, "#\n\r\t\v");
12251224
memcpy(dst, s, j);
12261225
}
12271226

0 commit comments

Comments
 (0)