add Kgio.tryopen method
commit6cefcff5889cceaa001f76f4be1a1c5e513b241d
authorEric Wong <normalperson@yhbt.net>
Fri, 13 May 2011 22:55:50 +0000 (13 15:55 -0700)
committerEric Wong <normalperson@yhbt.net>
Fri, 13 May 2011 22:55:50 +0000 (13 15:55 -0700)
tree1824896fe69e92bbe541b14f233d7269af6c33bd
parentab732113e13f1690fd2c1a18d1c66beb7864d847
add Kgio.tryopen method

For the case where a file is readable, it's faster to
just call open() instead of stat()-ing and then calling
open().

open() failures are still relatively cheap, too, they're still
more expensive than a failed stat() but cheaper than raising
an exception.
ext/kgio/kgio.h
ext/kgio/kgio_ext.c
ext/kgio/tryopen.c [new file with mode: 0644]
test/test_tryopen.rb [new file with mode: 0644]