From 0791d297dd31a241d7cf63a1a7dd510be2aafcb6 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 15 Sep 2008 05:36:15 +0000 Subject: [PATCH] * encoding.c (RUBY_MAX_CHAR_LEN): defined. * encoding.c (str_cat_char): use RUBY_MAX_CHAR_LEN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ string.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 89492428ac..2da3db02d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Sep 15 14:34:32 2008 NARUSE, Yui + + * encoding.c (RUBY_MAX_CHAR_LEN): defined. + + * encoding.c (str_cat_char): use RUBY_MAX_CHAR_LEN. + Mon Sep 15 13:53:33 2008 NARUSE, Yui * encoding.c (rb_enc_compatible): accepst other than strings and diff --git a/string.c b/string.c index dd61d52da7..843d770cd0 100644 --- a/string.c +++ b/string.c @@ -43,6 +43,7 @@ VALUE rb_cString; VALUE rb_cSymbol; +#define RUBY_MAX_CHAR_LEN 16 #define STR_TMPLOCK FL_USER7 #define STR_NOEMBED FL_USER1 #define STR_SHARED FL_USER2 /* = ELTS_SHARED */ @@ -3790,7 +3791,7 @@ rb_str_to_s(VALUE str) static void str_cat_char(VALUE str, int c, rb_encoding *enc) { - char s[16]; + char s[RUBY_MAX_CHAR_LEN]; int n = rb_enc_codelen(c, enc); rb_enc_mbcput(c, s, enc);