summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/string/depend1
-rw-r--r--ext/-test-/string/extconf.rb1
-rw-r--r--ext/-test-/string/normalize.c18
3 files changed, 20 insertions, 0 deletions
diff --git a/ext/-test-/string/depend b/ext/-test-/string/depend
index aad1fab4270..86617ff2898 100644
--- a/ext/-test-/string/depend
+++ b/ext/-test-/string/depend
@@ -2,3 +2,4 @@ $(OBJS): $(HDRS) $(ruby_headers) \
$(hdrdir)/ruby/encoding.h \
$(hdrdir)/ruby/oniguruma.h
qsort.o: $(hdrdir)/ruby/util.h
+normalize.o: $(top_srcdir)/internal.h
diff --git a/ext/-test-/string/extconf.rb b/ext/-test-/string/extconf.rb
index 42c10b994b7..10d33cbab9c 100644
--- a/ext/-test-/string/extconf.rb
+++ b/ext/-test-/string/extconf.rb
@@ -1,3 +1,4 @@
+$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
inits = $srcs.map {|s| File.basename(s, ".*")}
inits.delete("init")
diff --git a/ext/-test-/string/normalize.c b/ext/-test-/string/normalize.c
new file mode 100644
index 00000000000..22bb6d7887a
--- /dev/null
+++ b/ext/-test-/string/normalize.c
@@ -0,0 +1,18 @@
+#include "ruby.h"
+#include "internal.h"
+
+#ifdef __APPLE__
+static VALUE
+normalize_ospath(VALUE str)
+{
+ return rb_str_normalize_ospath(RSTRING_PTR(str), RSTRING_LEN(str));
+}
+#else
+#define normalize_ospath rb_f_notimplement
+#endif
+
+void
+Init_normalize(VALUE klass)
+{
+ rb_define_method(klass, "normalize_ospath", normalize_ospath, 0);
+}