From: Eric Wong <e@80x24.org>
To: mogilefs-client-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH] avoid defineclass instructions for empty classes
Date: Thu, 28 May 2015 19:04:57 +0000 [thread overview]
Message-ID: <1432839897-25626-1-git-send-email-e@80x24.org> (raw)
This needlessly wastes bytecode and saves around 2K memory
on 64-bit platforms.
---
lib/mogilefs.rb | 20 ++++++++++----------
lib/mogilefs/util.rb | 2 +-
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 @@ def self.now
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 @@ def message # :nodoc:
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 @@ def length
# 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)
--
EW
reply other threads:[~2015-05-28 19:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/mogilefs-client/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432839897-25626-1-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=mogilefs-client-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/mogilefs-client.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).