about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-05-28 19:01:35 +0000
committerEric Wong <e@80x24.org>2015-05-28 19:01:35 +0000
commitc32f1d06e0c82c09f79fa61447e1acb6b900e84e (patch)
tree3438a2d5e5bdafda3609db7c4ccedd6c80a333ac
parent5429893629154e39e0db33f5c98e237b29c7bbdc (diff)
downloadmogilefs-client-c32f1d06e0c82c09f79fa61447e1acb6b900e84e.tar.gz
This needlessly wastes bytecode and saves around 2K memory
on 64-bit platforms.
-rw-r--r--lib/mogilefs.rb20
-rw-r--r--lib/mogilefs/util.rb2
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/mogilefs.rb b/lib/mogilefs.rb
index 6059836..cf6b5df 100644
--- a/lib/mogilefs.rb
+++ b/lib/mogilefs.rb
@@ -16,18 +16,18 @@ module MogileFS
   end
 
   # Standard error class for most MogileFS-specific errors
-  class Error < StandardError; end
+  Error = Class.new(StandardError)
 
   # Raised when a socket remains unreadable for too long.
-  class UnreadableSocketError < Error; end
+  UnreadableSocketError = Class.new(Error)
 
   # Raised when a response is truncated while reading
   # due to network/server # errors)
-  class SizeMismatchError < Error; end
+  SizeMismatchError = Class.new(Error)
 
   # Raised when checksum verification fails (only while reading deprecated
   # "bigfiles" from the deprecated mogtool(1).
-  class ChecksumMismatchError < RuntimeError; end
+  ChecksumMismatchError = Class.new(RuntimeError)
 
   # Raised when a backend is in read-only mode
   class ReadOnlyError < Error
@@ -37,27 +37,27 @@ module MogileFS
   end
 
   # Raised when an upload is impossible
-  class EmptyPathError < Error; end
+  EmptyPathError = Class.new(Error)
 
   # Raised when we are given an unsupported protocol to upload to.
   # Currently, the \MogileFS (2.XX) server only supports HTTP and
   # this library is only capable of HTTP.
-  class UnsupportedPathError < Error; end
+  UnsupportedPathError = Class.new(Error)
 
   # Raised when a request (HTTP or tracker) was truncated due to a network or
   # server error.  It may be possible to retry idempotent requests from this.
-  class RequestTruncatedError < Error; end
+  RequestTruncatedError = Class.new(Error)
 
   # Raised when a response from a server (HTTP or tracker) is not in a format
   # that we expected (or truncated..
-  class InvalidResponseError < Error; end
+  InvalidResponseError = Class.new(Error)
 
   # Raised when all known backends have failed.
-  class UnreachableBackendError < Error; end
+  UnreachableBackendError = Class.new(Error)
 
   # There was an error as a result of the use of the (experimental)
   # pipelining code to the tracker backend
-  class PipelineError < Error; end
+  PipelineError = Class.new(Error)
 
   # :stopdoc:
   class << self
diff --git a/lib/mogilefs/util.rb b/lib/mogilefs/util.rb
index 6277497..ad4845d 100644
--- a/lib/mogilefs/util.rb
+++ b/lib/mogilefs/util.rb
@@ -24,4 +24,4 @@ require 'timeout'
 # Timeout error class.  Subclassing it from Timeout::Error is the only
 # reason we require the 'timeout' module, otherwise that module is
 # broken and worthless to us.
-class MogileFS::Timeout < Timeout::Error; end
+MogileFS::Timeout = Class.new(Timeout::Error)