[ruby/reline] Ensure compatibility with frozen string literals

(https://github.com/ruby/reline/pull/643)

Ref: https://bugs.ruby-lang.org/issues/20205

Ruby is moving forward with enabling frozen string literals
in the future.

Reline being part of the ruby-core test suite should work when
ruby is ran with `--enable-frozen-string-literal`.

https://github.com/ruby/reline/commit/7e2de64cf0

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
This commit is contained in:
Jean byroot Boussier 2024-03-14 17:09:03 +01:00 коммит произвёл git
Родитель d10afe0357
Коммит 161545d55d
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -68,7 +68,7 @@ class Reline::KillRing
def append(string, before_p = false)
case @state
when State::FRESH, State::YANK
@ring << RingPoint.new(string)
@ring << RingPoint.new(+string)
@state = State::CONTINUED
when State::CONTINUED, State::PROCESSED
if before_p

Просмотреть файл

@ -1256,7 +1256,7 @@ class Reline::LineEditor
item_mbchars = item.grapheme_clusters
end
size = [memo_mbchars.size, item_mbchars.size].min
result = ''
result = +''
size.times do |i|
if @config.completion_ignore_case
if memo_mbchars[i].casecmp?(item_mbchars[i])
@ -2935,7 +2935,7 @@ class Reline::LineEditor
end
private def ed_delete_prev_char(key, arg: 1)
deleted = ''
deleted = +''
arg.times do
if @cursor > 0
byte_size = Reline::Unicode.get_prev_mbchar_size(@line, @byte_pointer)

Просмотреть файл

@ -85,7 +85,7 @@ class Reline::Windows
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
args[i], = [x == 0 ? nil : x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
ret, = @func.call(*args)