Skip to content

Commit a9a20dd

Browse files
committed
CallbackHandler: 'name' -> 'key'
1 parent 6ee7509 commit a9a20dd

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

miasm2/jitter/jitload.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ class CallbackHandler(object):
6767
def __init__(self):
6868
self.callbacks = {} # Key -> [callback list]
6969

70-
def add_callback(self, name, callback):
71-
"""Add a callback to the key @name, iff the @callback isn't already
70+
def add_callback(self, key, callback):
71+
"""Add a callback to the key @key, iff the @callback isn't already
7272
assigned to it"""
73-
if callback not in self.callbacks.get(name, []):
74-
self.callbacks[name] = self.callbacks.get(name, []) + [callback]
73+
if callback not in self.callbacks.get(key, []):
74+
self.callbacks[key] = self.callbacks.get(key, []) + [callback]
7575

76-
def set_callback(self, name, *args):
77-
"Set the list of callback for key 'name'"
78-
self.callbacks[name] = list(args)
76+
def set_callback(self, key, *args):
77+
"Set the list of callback for key 'key'"
78+
self.callbacks[key] = list(args)
7979

80-
def get_callbacks(self, name):
81-
"Return the list of callbacks associated to key 'name'"
82-
return self.callbacks.get(name, [])
80+
def get_callbacks(self, key):
81+
"Return the list of callbacks associated to key 'key'"
82+
return self.callbacks.get(key, [])
8383

8484
def remove_callback(self, callback):
8585
"""Remove the callback from the list.
@@ -101,30 +101,30 @@ def remove_callback(self, callback):
101101

102102
return empty_keys
103103

104-
def has_callbacks(self, name):
105-
return name in self.callbacks
104+
def has_callbacks(self, key):
105+
return key in self.callbacks
106106

107-
def remove_name(self, name):
108-
"""Remove and return all callbacks associated to @name"""
109-
callbacks = self.callbacks.get(name, [])
110-
del self.callbacks[name]
107+
def remove_key(self, key):
108+
"""Remove and return all callbacks associated to @key"""
109+
callbacks = self.callbacks.get(key, [])
110+
del self.callbacks[key]
111111
return callbacks
112112

113-
def call_callbacks(self, name, *args):
114-
"""Call callbacks associated to key 'name' with arguments args. While
113+
def call_callbacks(self, key, *args):
114+
"""Call callbacks associated to key 'key' with arguments args. While
115115
callbacks return True, continue with next callback.
116116
Iterator on other results."""
117117

118118
res = True
119119

120-
for c in self.get_callbacks(name):
120+
for c in self.get_callbacks(key):
121121
res = c(*args)
122122
if res is not True:
123123
yield res
124124

125-
def __call__(self, name, *args):
125+
def __call__(self, key, *args):
126126
"Wrapper for call_callbacks"
127-
return self.call_callbacks(name, *args)
127+
return self.call_callbacks(key, *args)
128128

129129

130130
class CallbackHandlerBitflag(CallbackHandler):
@@ -309,7 +309,7 @@ def remove_breakpoints_by_address(self, address):
309309
"""Remove all breakpoints associated with @address.
310310
@address: address of breakpoints to remove
311311
"""
312-
callbacks = self.breakpoints_handler.remove_name(address)
312+
callbacks = self.breakpoints_handler.remove_key(address)
313313
if callbacks:
314314
self.jit.remove_disassembly_splits(address)
315315

0 commit comments

Comments
 (0)