diff options
author | Jemma Issroff <[email protected]> | 2023-07-07 12:52:03 -0400 |
---|---|---|
committer | git <[email protected]> | 2023-07-07 17:46:45 +0000 |
commit | 61efa9c823263697b1625b411fff33d8dc3cd11d (patch) | |
tree | 9b5e1ad6462619800eb5db317645f0229e969f73 /yarp/extension.c | |
parent | 24d9e21f84eced634b3e443ada2a57621b2b4b9b (diff) |
[ruby/yarp] Remove bin/newlines
Since newlines are working, this bin/newlines is less helpful, and
we can remove the API for newlines
https://github.com/ruby/yarp/commit/b538460b99
Diffstat (limited to 'yarp/extension.c')
-rw-r--r-- | yarp/extension.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/yarp/extension.c b/yarp/extension.c index 41031ac82f..f0d22c7f8c 100644 --- a/yarp/extension.c +++ b/yarp/extension.c @@ -613,28 +613,6 @@ profile_file(VALUE self, VALUE filepath) { return Qnil; } -// The function takes a source string and returns a Ruby array containing the -// offsets of every newline in the string. (It also includes a 0 at the -// beginning to indicate the position of the first line.) It accepts a string as -// its only argument and returns an array of integers. -static VALUE -newlines(VALUE self, VALUE string) { - yp_parser_t parser; - size_t length = RSTRING_LEN(string); - yp_parser_init(&parser, RSTRING_PTR(string), length, NULL); - - yp_node_t *node = yp_parse(&parser); - yp_node_destroy(&parser, node); - - VALUE result = rb_ary_new_capa(parser.newline_list.size); - for (size_t index = 0; index < parser.newline_list.size; index++) { - rb_ary_push(result, INT2FIX(parser.newline_list.offsets[index])); - } - - yp_parser_free(&parser); - return result; -} - /******************************************************************************/ /* Initialization of the extension */ /******************************************************************************/ @@ -683,7 +661,6 @@ Init_yarp(void) { rb_define_singleton_method(rb_cYARP, "unescape_all", unescape_all, 1); rb_define_singleton_method(rb_cYARP, "memsize", memsize, 1); rb_define_singleton_method(rb_cYARP, "profile_file", profile_file, 1); - rb_define_singleton_method(rb_cYARP, "newlines", newlines, 1); // Next, initialize the pack API. Init_yarp_pack(); |