зеркало из https://github.com/github/ruby.git
Fix -Wsign-compare on String#initialize
../string.c:1886:57: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare] 1886 | if (STR_EMBED_P(str)) RUBY_ASSERT(osize <= str_embed_capa(str)); | ^~
This commit is contained in:
Родитель
38bf622cdc
Коммит
d5080f6e8b
2
string.c
2
string.c
|
@ -1883,7 +1883,7 @@ rb_str_init(int argc, VALUE *argv, VALUE str)
|
|||
const char *const old_ptr = RSTRING_PTR(str);
|
||||
const size_t osize = RSTRING_LEN(str) + TERM_LEN(str);
|
||||
char *new_ptr = ALLOC_N(char, size);
|
||||
if (STR_EMBED_P(str)) RUBY_ASSERT(osize <= str_embed_capa(str));
|
||||
if (STR_EMBED_P(str)) RUBY_ASSERT((long)osize <= str_embed_capa(str));
|
||||
memcpy(new_ptr, old_ptr, osize < size ? osize : size);
|
||||
FL_UNSET_RAW(str, STR_SHARED|STR_NOFREE);
|
||||
RSTRING(str)->as.heap.ptr = new_ptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче