Skip to content

Commit

Permalink
Remove exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
zygzagZ committed May 7, 2021
1 parent ab10af0 commit 473936a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
24 changes: 1 addition & 23 deletions lib/elftools/enums.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,7 @@ def self.enum_attr(name, num)
name = name.to_s

define_method("#{name}?") do
if self.class.exclusive?
@attrs == num
else
@attrs & num != 0
end
end

define_method("#{name}=") do |set|
if set
@attrs |= num
else
@attrs &= ~num
end
@attrs == num
end

define_singleton_method(name.upcase.to_sym) do
Expand All @@ -32,16 +20,6 @@ def self.enum_attr(name, num)

class << self
attr_reader :values

def exclusive?
@exclusive
end

private

def exclusive(enabled)
@exclusive = enabled
end
end

# Initialize enum with value or name
Expand Down
2 changes: 0 additions & 2 deletions lib/elftools/sections/relocation_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class Relocation
attr_reader :stream # @return [#pos=, #read] Streaming object.

class Relocation32 < Enum
exclusive true
enum_attr :none, 0
enum_attr :"32", 1
enum_attr :pc32, 2
Expand All @@ -101,7 +100,6 @@ class Relocation32 < Enum
end

class Relocation64 < Enum
exclusive true
enum_attr :none, 0
enum_attr :"64", 1
enum_attr :pc32, 2
Expand Down
3 changes: 0 additions & 3 deletions lib/elftools/sections/sym_tab_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class Symbol

# based on https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-79797.html
class Bind < Enum
exclusive true
enum_attr :local, 0
enum_attr :global, 1
enum_attr :weak, 2
Expand All @@ -117,7 +116,6 @@ class Bind < Enum
end

class Type < Enum
exclusive true
enum_attr :notype, 0
enum_attr :object, 1
enum_attr :func, 2
Expand All @@ -133,7 +131,6 @@ class Type < Enum
end

class Visibility < Enum
exclusive true
enum_attr :default, 0
enum_attr :internal, 1
enum_attr :hidden, 2
Expand Down

0 comments on commit 473936a

Please sign in to comment.