From 179cdd098196338880bdbb39c39a788abdad4dd8 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 8 May 2015 21:58:57 +0300 Subject: 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. --- src/bin/pg_basebackup/pg_receivexlog.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/bin/pg_basebackup/pg_receivexlog.c') 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; -- cgit v1.2.3