Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Prefer rb_enc_str_new(0, 0, ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 20, 2017
1 parent e6b164e commit a51bd5f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ext/trenni/markup.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ VALUE Trenni_Native_parse_markup(VALUE self, VALUE buffer, VALUE delegate, VALUE

VALUE pcdata = Qnil;

VALUE empty_string = rb_obj_freeze(rb_enc_str_new("", 0, encoding));
VALUE empty_string = rb_obj_freeze(rb_enc_str_new(0, 0, encoding));

const char *s, *p, *pe, *eof;
unsigned long cs, top = 0, stack[2] = {0};
Expand Down
2 changes: 1 addition & 1 deletion ext/trenni/markup.rl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ VALUE Trenni_Native_parse_markup(VALUE self, VALUE buffer, VALUE delegate, VALUE

VALUE pcdata = Qnil;

VALUE empty_string = rb_obj_freeze(rb_enc_str_new("", 0, encoding));
VALUE empty_string = rb_obj_freeze(rb_enc_str_new(0, 0, encoding));

const char *s, *p, *pe, *eof;
unsigned long cs, top = 0, stack[2] = {0};
Expand Down
2 changes: 1 addition & 1 deletion ext/trenni/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ VALUE Trenni_Tag_append_tag(VALUE self, VALUE buffer, VALUE name, VALUE attribut
VALUE Trenni_Tag_format_tag(VALUE self, VALUE name, VALUE attributes, VALUE content) {
rb_encoding *encoding = rb_enc_get(name);

VALUE buffer = rb_enc_str_new("", 0, encoding);
VALUE buffer = rb_enc_str_new(0, 0, encoding);

Trenni_Tag_append_tag(self, buffer, name, attributes, content);

Expand Down
4 changes: 2 additions & 2 deletions ext/trenni/trenni.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ NORETURN(void Trenni_raise_error(const char * message, VALUE buffer, size_t offs

static inline void Trenni_append(VALUE * buffer, rb_encoding * encoding, VALUE string) {
if (*buffer == Qnil) {
*buffer = rb_enc_str_new("", 0, encoding);
*buffer = rb_enc_str_new(0, 0, encoding);
}

rb_str_concat(*buffer, string);
Expand All @@ -74,7 +74,7 @@ static inline void Trenni_append_token(VALUE * buffer, rb_encoding * encoding, T

static inline void Trenni_append_codepoint(VALUE * buffer, rb_encoding * encoding, unsigned long codepoint) {
if (*buffer == Qnil) {
*buffer = rb_enc_str_new("", 0, encoding);
*buffer = rb_enc_str_new(0, 0, encoding);
}

rb_str_concat(*buffer, ULONG2NUM(codepoint));
Expand Down

0 comments on commit a51bd5f

Please sign in to comment.