summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/socket/lib/socket.rb4
-rw-r--r--test/socket/test_addrinfo.rb2
-rw-r--r--test/socket/test_ancdata.rb2
-rw-r--r--test/socket/test_basicsocket.rb2
-rw-r--r--test/socket/test_nonblock.rb4
-rw-r--r--test/socket/test_socket.rb2
-rw-r--r--test/socket/test_sockopt.rb2
-rw-r--r--test/socket/test_tcp.rb2
-rw-r--r--test/socket/test_udp.rb2
-rw-r--r--test/socket/test_unix.rb4
11 files changed, 27 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6be574d..c92acec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Nov 14 22:15:07 2015 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb: Specify frozen_string_literal: true.
+
Sat Nov 14 21:44:56 2015 Tanaka Akira <akr@fsij.org>
* lib/time.rb: Use "<<" to reduce string allocation.
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 7c66e8f..d5f66bc 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'socket.so'
require 'io/wait'
@@ -747,7 +749,7 @@ class Socket < BasicSocket
attr_reader :local_address
def inspect # :nodoc:
- "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>"
+ "\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>".dup
end
# Sends the String +msg+ to the source
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index b83118f..a607a84 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
rescue LoadError
diff --git a/test/socket/test_ancdata.rb b/test/socket/test_ancdata.rb
index 112b0c9..b2f86a0 100644
--- a/test/socket/test_ancdata.rb
+++ b/test/socket/test_ancdata.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test/unit'
require 'socket'
diff --git a/test/socket/test_basicsocket.rb b/test/socket/test_basicsocket.rb
index da977b3..227034e 100644
--- a/test/socket/test_basicsocket.rb
+++ b/test/socket/test_basicsocket.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
require "test/unit"
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb
index 55198ba..3f8d548 100644
--- a/test/socket/test_nonblock.rb
+++ b/test/socket/test_nonblock.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
require "io/nonblock"
@@ -129,7 +131,7 @@ class TestSocketNonblock < Test::Unit::TestCase
mesg = u1.recv_nonblock(100)
assert_equal("", mesg)
- buf = "short"
+ buf = "short".dup
out = "hello world" * 4
out.freeze
u2.send(out, 0, u1.getsockname)
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb
index 3682338..2668462 100644
--- a/test/socket/test_socket.rb
+++ b/test/socket/test_socket.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
require "tmpdir"
diff --git a/test/socket/test_sockopt.rb b/test/socket/test_sockopt.rb
index 2ee06db..0a2937e 100644
--- a/test/socket/test_sockopt.rb
+++ b/test/socket/test_sockopt.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test/unit'
require 'socket'
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb
index 5e3528e..c0e34eb 100644
--- a/test/socket/test_tcp.rb
+++ b/test/socket/test_tcp.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
require "test/unit"
diff --git a/test/socket/test_udp.rb b/test/socket/test_udp.rb
index 5693337..5b23cce 100644
--- a/test/socket/test_udp.rb
+++ b/test/socket/test_udp.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
require "test/unit"
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 9ca97d2..313a1f0 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
begin
require "socket"
rescue LoadError
@@ -386,7 +388,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
assert_equal("", s1.recv(10))
assert_raise(IO::EAGAINWaitReadable) { s1.recv_nonblock(10) }
- buf = ""
+ buf = "".dup
s2.send("BBBBBB", 0)
IO.select([s1])
rv = s1.recv(100, 0, buf)