[前][次][番号順一覧][スレッド一覧]

ruby-changes:71506

From: Hiroshi <ko1@a...>
Date: Fri, 25 Mar 2022 09:53:17 +0900 (JST)
Subject: [ruby-changes:71506] 8e3fbf9432 (master): Merge psych master: Removed the bundled libyaml

https://git.ruby-lang.org/ruby.git/commit/?id=8e3fbf9432

From 8e3fbf943236aa3c78c8320f8ab11944e1c861de Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Wed, 23 Mar 2022 17:06:15 +0900
Subject: Merge psych master: Removed the bundled libyaml

---
 ext/psych/psych.gemspec       |    3 -
 ext/psych/yaml/api.c          | 1393 ----------------
 ext/psych/yaml/config.h       |   80 -
 ext/psych/yaml/dumper.c       |  394 -----
 ext/psych/yaml/emitter.c      | 2358 ---------------------------
 ext/psych/yaml/loader.c       |  544 -------
 ext/psych/yaml/parser.c       | 1375 ----------------
 ext/psych/yaml/reader.c       |  469 ------
 ext/psych/yaml/scanner.c      | 3598 -----------------------------------------
 ext/psych/yaml/writer.c       |  141 --
 ext/psych/yaml/yaml.h         | 1985 -----------------------
 ext/psych/yaml/yaml_private.h |  688 --------
 12 files changed, 13028 deletions(-)
 delete mode 100644 ext/psych/yaml/api.c
 delete mode 100644 ext/psych/yaml/config.h
 delete mode 100644 ext/psych/yaml/dumper.c
 delete mode 100644 ext/psych/yaml/emitter.c
 delete mode 100644 ext/psych/yaml/loader.c
 delete mode 100644 ext/psych/yaml/parser.c
 delete mode 100644 ext/psych/yaml/reader.c
 delete mode 100644 ext/psych/yaml/scanner.c
 delete mode 100644 ext/psych/yaml/writer.c
 delete mode 100644 ext/psych/yaml/yaml.h
 delete mode 100644 ext/psych/yaml/yaml_private.h

diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec
index 65dd7156cb..5f5168ddb0 100644
--- a/ext/psych/psych.gemspec
+++ b/ext/psych/psych.gemspec
@@ -27,9 +27,6 @@ DESCRIPTION https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L27
     "bin/setup", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h",
     "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h",
     "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h",
-    "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c",
-    "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c",
-    "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h",
     "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/exception.rb",
     "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb",
     "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb",
diff --git a/ext/psych/yaml/api.c b/ext/psych/yaml/api.c
deleted file mode 100644
index 6add8b2661..0000000000
--- a/ext/psych/yaml/api.c
+++ /dev/null
@@ -1,1393 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.gemspec#L0
-
-#include "yaml_private.h"
-
-/*
- * Get the library version.
- */
-
-YAML_DECLARE(const char *)
-yaml_get_version_string(void)
-{
-    return YAML_VERSION_STRING;
-}
-
-/*
- * Get the library version numbers.
- */
-
-YAML_DECLARE(void)
-yaml_get_version(int *major, int *minor, int *patch)
-{
-    *major = YAML_VERSION_MAJOR;
-    *minor = YAML_VERSION_MINOR;
-    *patch = YAML_VERSION_PATCH;
-}
-
-/*
- * Allocate a dynamic memory block.
- */
-
-YAML_DECLARE(void *)
-yaml_malloc(size_t size)
-{
-    return malloc(size ? size : 1);
-}
-
-/*
- * Reallocate a dynamic memory block.
- */
-
-YAML_DECLARE(void *)
-yaml_realloc(void *ptr, size_t size)
-{
-    return ptr ? realloc(ptr, size ? size : 1) : malloc(size ? size : 1);
-}
-
-/*
- * Free a dynamic memory block.
- */
-
-YAML_DECLARE(void)
-yaml_free(void *ptr)
-{
-    if (ptr) free(ptr);
-}
-
-/*
- * Duplicate a string.
- */
-
-YAML_DECLARE(yaml_char_t *)
-yaml_strdup(const yaml_char_t *str)
-{
-    if (!str)
-        return NULL;
-
-    return (yaml_char_t *)strdup((char *)str);
-}
-
-/*
- * Extend a string.
- */
-
-YAML_DECLARE(int)
-yaml_string_extend(yaml_char_t **start,
-        yaml_char_t **pointer, yaml_char_t **end)
-{
-    yaml_char_t *new_start = (yaml_char_t *)yaml_realloc((void*)*start, (*end - *start)*2);
-
-    if (!new_start) return 0;
-
-    memset(new_start + (*end - *start), 0, *end - *start);
-
-    *pointer = new_start + (*pointer - *start);
-    *end = new_start + (*end - *start)*2;
-    *start = new_start;
-
-    return 1;
-}
-
-/*
- * Append a string B to a string A.
- */
-
-YAML_DECLARE(int)
-yaml_string_join(
-        yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end,
-        yaml_char_t **b_start, yaml_char_t **b_pointer, SHIM(yaml_char_t **b_end))
-{
-    UNUSED_PARAM(b_end)
-    if (*b_start == *b_pointer)
-        return 1;
-
-    while (*a_end - *a_pointer <= *b_pointer - *b_start) {
-        if (!yaml_string_extend(a_start, a_pointer, a_end))
-            return 0;
-    }
-
-    memcpy(*a_pointer, *b_start, *b_pointer - *b_start);
-    *a_pointer += *b_pointer - *b_start;
-
-    return 1;
-}
-
-/*
- * Extend a stack.
- */
-
-YAML_DECLARE(int)
-yaml_stack_extend(void **start, void **top, void **end)
-{
-    void *new_start;
-
-    if ((char *)*end - (char *)*start >= INT_MAX / 2)
-	return 0;
-
-    new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
-
-    if (!new_start) return 0;
-
-    *top = (char *)new_start + ((char *)*top - (char *)*start);
-    *end = (char *)new_start + ((char *)*end - (char *)*start)*2;
-    *start = new_start;
-
-    return 1;
-}
-
-/*
- * Extend or move a queue.
- */
-
-YAML_DECLARE(int)
-yaml_queue_extend(void **start, void **head, void **tail, void **end)
-{
-    /* Check if we need to resize the queue. */
-
-    if (*start == *head && *tail == *end) {
-        void *new_start = yaml_realloc(*start,
-                ((char *)*end - (char *)*start)*2);
-
-        if (!new_start) return 0;
-
-        *head = (char *)new_start + ((char *)*head - (char *)*start);
-        *tail = (char *)new_start + ((char *)*tail - (char *)*start);
-        *end = (char *)new_start + ((char *)*end - (char *)*start)*2;
-        *start = new_start;
-    }
-
-    /* Check if we need to move the queue at the beginning of the buffer. */
-
-    if (*tail == *end) {
-        if (*head != *tail) {
-            memmove(*start, *head, (char *)*tail - (char *)*head);
-        }
-        *tail = (char *)*tail - (char *)*head + (char *)*start;
-        *head = *start;
-    }
-
-    return 1;
-}
-
-
-/*
- * Create a new parser object.
- */
-
-YAML_DECLARE(int)
-yaml_parser_initialize(yaml_parser_t *parser)
-{
-    assert(parser);     /* Non-NULL parser object expected. */
-
-    memset(parser, 0, sizeof(yaml_parser_t));
-    if (!BUFFER_INIT(parser, parser->raw_buffer, INPUT_RAW_BUFFER_SIZE))
-        goto error;
-    if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE))
-        goto error;
-    if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE, yaml_token_t*))
-        goto error;
-    if (!STACK_INIT(parser, parser->indents, int*))
-        goto error;
-    if (!STACK_INIT(parser, parser->simple_keys, yaml_simple_key_t*))
-        goto error;
-    if (!STACK_INIT(parser, parser->states, yaml_parser_state_t*))
-        goto error;
-    if (!STACK_INIT(parser, parser->marks, yaml_mark_t*))
-        goto error;
-    if (!STACK_INIT(parser, parser->tag_directives, yaml_tag_directive_t*))
-        goto error;
-
-    return 1;
-
-error:
-
-    BUFFER_DEL(parser, parser->raw_buffer);
-    BUFFER_DEL(parser, parser->buffer);
-    QUEUE_DEL(parser, parser->tokens);
-    STACK_DEL(parser, parser->indents);
-    STACK_DEL(parser, parser->simple_keys);
-    STACK_DEL(parser, parser->states);
-    STACK_DEL(parser, parser->marks);
-    STACK_DEL(parser, parser->tag_directives);
-
-    return 0;
-}
-
-/*
- * Destroy a parser object.
- */
-
-YAML_DECLARE(void)
-yaml_parser_delete(yaml_parser_t *parser)
-{
-    assert(parser); /* Non-NULL parser object expected. */
-
-    BUFFER_DEL(parser, parser->raw_buffer);
-    BUFFER_DEL(parser, parser->buffer);
-    while (!QUEUE_EMPTY(parser, parser->tokens)) {
-        yaml_token_delete(&DEQUEUE(parser, parser->tokens));
-    }
-    QUEUE_DEL(parser, parser->tokens);
-    STACK_DEL(parser, parser->indents);
-    STACK_DEL(parser, parser->simple_keys);
-    STACK_DEL(parser, parser->states);
-    STACK_DEL(parser, parser->marks);
-    while (!STACK_EMPTY(parser, parser->tag_directives)) {
-        yaml_tag_directive_t tag_directive = POP(parser, parser->tag_directives);
-        yaml_free(tag_directive.handle);
-        yaml_free(tag_directive.prefix);
-    }
-    STACK_DEL(parser, parser->tag_directives);
-
-    memset(parser, 0, sizeof(yaml_parser_t));
-}
-
-/*
- * String read handler.
- */
-
-static int
-yaml_string_read_handler(void *data, unsigned char *buffer, size_t size,
-        size_t *size_read)
-{
-    yaml_parser_t *parser = (yaml_parser_t *)data;
-
-    if (parser->input.string.current == parser->input.string.end) {
-        *size_read = 0;
-        return 1;
-    }
-
-    if (size > (size_t)(parser->input.string.end
-                - parser->input.string.current)) {
-        size = parser->input.string.end - parser->input.string.current;
-    }
-
-    memcpy(buffer, parser->input.string.current, size);
-    parser->input.string.current += size;
-    *size_read = size;
-    return 1;
-}
-
-/*
- * File read handler.
- */
-
-static int
-yaml_file_read_handler(void *data, unsigned char *buffer, size_t size,
-        size_t *size_read)
-{
-    yaml_parser_t *parser = (yaml_parser_t *)data;
-
-    *size_read = fread(buffer, 1, size, parser->input.file);
-    return !ferror(parser->input.file);
-}
-
-/*
- * Set a string input.
- */
-
-YAML_DECLARE(void)
-yaml_parser_set_input_string(yaml_parser_t *parser,
-        const unsigned char *input, size_t size)
-{
-    assert(parser); /* Non-NULL parser object expected. */
-    assert(!parser->read_handler);  /* You can set the source only once. */
-    assert(input);  /* Non-NULL in (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]