summaryrefslogtreecommitdiff
path: root/src/basic/copy.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-23 18:24:07 +0100
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commitab959b08aaa808f4b2b48295e06e3eb103600958 (patch)
tree5d3d087366e9daa744bc4bd2f6b45ef7ab630c5e /src/basic/copy.c
parent68055130494fecb49dd775934661a687cc8f8e58 (diff)
copy: drop _unlikely_() that isn't obviously the case
If a tool only invokes copy_bytes() a single time the _unlikely_() will always be wrong, and is hence not useful. Let's drop it and let the compiler figure our what to do, instead of misleading it. Also, some coding style imprvoements.
Diffstat (limited to 'src/basic/copy.c')
-rw-r--r--src/basic/copy.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 24a4252f9..7d46f5678 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -38,23 +38,25 @@
#define COPY_BUFFER_SIZE (16*1024u)
-static ssize_t try_copy_file_range(int fd_in, loff_t *off_in,
- int fd_out, loff_t *off_out,
- size_t len,
- unsigned int flags) {
+static ssize_t try_copy_file_range(
+ int fd_in, loff_t *off_in,
+ int fd_out, loff_t *off_out,
+ size_t len,
+ unsigned int flags) {
+
static int have = -1;
ssize_t r;
- if (have == false)
+ if (have == 0)
return -ENOSYS;
r = copy_file_range(fd_in, off_in, fd_out, off_out, len, flags);
- if (_unlikely_(have < 0))
+ if (have < 0)
have = r >= 0 || errno != ENOSYS;
- if (r >= 0)
- return r;
- else
+ if (r < 0)
return -errno;
+
+ return r;
}
enum {