def tag_write(ea, key, none):
'''Removes the tag specified by ``key`` from the address ``ea``.'''
ea = interface.address.inside(ea)
# if the '__name__' is being cleared, then really remove it.
if key == '__name__':
return set_name(ea, None, listed=True)
if key == '__extra_prefix__':
return extra.del_prefix(ea)
if key == '__extra_suffix__':
return extra.del_suffix(ea)
# if not within a function, then fetch the repeatable comment
# otherwise update the non-repeatable one
try: func = function.by_address(ea)
except: func = None
repeatable = False if func else True
# fetch the dict, remove the key, then write it back.
state = internal.comment.decode(comment(ea, repeatable=not repeatable))
state and comment(ea, '', repeatable=not repeatable) # clear the old one
state.update(internal.comment.decode(comment(ea, repeatable=repeatable)))
res = state.pop(key)
comment(ea, internal.comment.encode(state), repeatable=repeatable)
# delete it's reference
if func:
internal.comment.contents.dec(ea, key)
else:
internal.comment.globals.dec(ea, key)
return res
#FIXME: define tag_erase
评论列表
文章目录