diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-05-08 21:58:57 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-05-08 21:58:57 +0300 |
commit | 179cdd098196338880bdbb39c39a788abdad4dd8 (patch) | |
tree | ba94b277b326f1599d2835f0fe50b791016dd532 /src/bin/pg_basebackup/pg_receivexlog.c | |
parent | 16c73e773bc5f2eee6a71c5ec311b8691bf9e832 (diff) | |
download | postgresql-179cdd098196338880bdbb39c39a788abdad4dd8.tar.gz postgresql-179cdd098196338880bdbb39c39a788abdad4dd8.zip |
Add macros to check if a filename is a WAL segment or other such file.
We had many instances of the strlen + strspn combination to check for that.
This makes the code a bit easier to read.
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivexlog.c')
-rw-r--r-- | src/bin/pg_basebackup/pg_receivexlog.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index e77d2b6d708..53802af896b 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -188,23 +188,11 @@ FindStreamingStart(uint32 *tli) /* * Check if the filename looks like an xlog file, or a .partial file. - * Xlog files are always 24 characters, and .partial files are 32 - * characters. */ - if (strlen(dirent->d_name) == 24) - { - if (strspn(dirent->d_name, "0123456789ABCDEF") != 24) - continue; + if (IsXLogFileName(dirent->d_name)) ispartial = false; - } - else if (strlen(dirent->d_name) == 32) - { - if (strspn(dirent->d_name, "0123456789ABCDEF") != 24) - continue; - if (strcmp(&dirent->d_name[24], ".partial") != 0) - continue; + else if (IsPartialXLogFileName(dirent->d_name)) ispartial = true; - } else continue; |