diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2020-10-11 19:29:19 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2020-10-11 19:29:19 +0200 |
| commit | 898a0aa157fd7b65e0f3aee3d5c1291955dbb3b7 (patch) | |
| tree | f174a8b3ce94c3371df4bdbebe94972d5a13bdb0 | |
| parent | 9474229d2d09515a818377318f789b5b8a104b23 (diff) | |
| download | miasm-898a0aa157fd7b65e0f3aee3d5c1291955dbb3b7.tar.gz miasm-898a0aa157fd7b65e0f3aee3d5c1291955dbb3b7.zip | |
Use default names in parse_asm
| -rw-r--r-- | miasm/core/parse_asm.py | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/miasm/core/parse_asm.py b/miasm/core/parse_asm.py index 509f0483..19bf4415 100644 --- a/miasm/core/parse_asm.py +++ b/miasm/core/parse_asm.py @@ -61,19 +61,6 @@ class DirectiveDontSplit(Directive): pass -def guess_next_new_label(loc_db): - """Generate a new label - @loc_db: the LocationDB instance""" - i = 0 - gen_name = "loc_%.8X" - while True: - name = gen_name % i - label = loc_db.get_name_location(name) - if label is None: - return loc_db.add_location(name) - i += 1 - - STATE_NO_BLOC = 0 STATE_IN_BLOC = 1 @@ -227,7 +214,7 @@ def parse_txt(mnemo, attrib, txt, loc_db): elif not isinstance(line, LocKey): # First line must be a label. If it's not the case, generate # it. - loc = guess_next_new_label(loc_db) + loc = loc_db.add_location() cur_block = asmblock.AsmBlock(loc_db, loc, alignment=mnemo.alignment) else: cur_block = asmblock.AsmBlock(loc_db, line, alignment=mnemo.alignment) |