diff options
-rw-r--r-- | README | 7 | ||||
-rwxr-xr-x | ext/rpatricia/extconf.rb | 1 | ||||
-rw-r--r-- | ext/rpatricia/patricia.c | 8 |
3 files changed, 11 insertions, 5 deletions
@@ -60,10 +60,9 @@ new: pt = Patricia.new - This is the class' constructor - it returns a Patricia object upon - success or nil on failure. For now, the constructor takes no - arguments, and defaults to creating a tree which uses AF_INET IPv4 - address and mask values as keys. + This is the class' constructor - it returns a Patricia object. For + now, the constructor takes no arguments, and defaults to creating a + tree which uses AF_INET IPv4 address and mask values as keys. The Patricia object will be destroyed automatically when there are no longer any references to it. diff --git a/ext/rpatricia/extconf.rb b/ext/rpatricia/extconf.rb index 18bb7a7..f8753af 100755 --- a/ext/rpatricia/extconf.rb +++ b/ext/rpatricia/extconf.rb @@ -1,5 +1,6 @@ #!/usr/bin/env ruby require "mkmf" +have_func("ruby_xcalloc") have_func("rb_str_set_len", "ruby.h") create_makefile("rpatricia") diff --git a/ext/rpatricia/patricia.c b/ext/rpatricia/patricia.c index d211a34..7fc3d27 100644 --- a/ext/rpatricia/patricia.c +++ b/ext/rpatricia/patricia.c @@ -31,7 +31,13 @@ static char copyright[] = #include "patricia.h" -#define Delete free +#if defined(HAVE_RUBY_XCALLOC) +# include <ruby.h> +# define calloc xcalloc +# define Delete xfree +#else +# define Delete free +#endif /* { from prefix.c */ |