about summary refs log tree commit homepage
path: root/lib/sleepy_penguin/cfr.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-01-05 00:49:02 +0000
committerEric Wong <e@80x24.org>2017-01-05 08:39:07 +0000
commit56c4eb8a98957da88ef8efd42c6e39eaf0a1b69d (patch)
tree087aebe4bd96b3b997b07f78cafc6d430ffd9eae /lib/sleepy_penguin/cfr.rb
parent1b355863e42164110a074a9313966ffebf880fb7 (diff)
downloadsleepy_penguin-56c4eb8a98957da88ef8efd42c6e39eaf0a1b69d.tar.gz
Keyword args allows for a smaller interface for common use,
while retaining the capability to use offsets for both input and
output.  The current (2.4) Ruby C API for keyword args is slow
and creates too many garbage objects.  As with our splice
wrapper, use a pure Ruby wrapper around an internal C function.
Diffstat (limited to 'lib/sleepy_penguin/cfr.rb')
-rw-r--r--lib/sleepy_penguin/cfr.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sleepy_penguin/cfr.rb b/lib/sleepy_penguin/cfr.rb
new file mode 100644
index 0000000..af94499
--- /dev/null
+++ b/lib/sleepy_penguin/cfr.rb
@@ -0,0 +1,6 @@
+module SleepyPenguin
+  def self.copy_file_range(io_in, io_out, len, flags = 0,
+                           off_in: nil, off_out: nil)
+    __cfr(io_in, off_in, io_out, off_out, len, flags)
+  end
+end