From 4e645d3ab895a702281ca17fc62769a3639dbe6d Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 17 May 2001 21:42:41 +0000 Subject: [PATCH] Added DelCodeEntries git-svn-id: svn://svn.cc65.org/cc65/trunk@730 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/codeseg.c | 17 ++++++++++++++++- src/cc65/codeseg.h | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index 8cf8bb070..ed2819de9 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -181,7 +181,7 @@ static const char* ReadToken (const char* L, const char* Term, /* Return the updated line pointer */ return L; } - + static CodeEntry* ParseInsn (CodeSeg* S, const char* L) @@ -527,6 +527,21 @@ void DelCodeEntry (CodeSeg* S, unsigned Index) +void DelCodeEntries (CodeSeg* S, unsigned Start, unsigned Count) +/* Delete a range of code entries. This includes removing references to labels, + * labels attached to the entries and so on. + */ +{ + /* Start deleting the entries from the rear, because this involves less + * memory moving. + */ + while (Count--) { + DelCodeEntry (S, Start + Count); + } +} + + + struct CodeEntry* GetNextCodeEntry (CodeSeg* S, unsigned Index) /* Get the code entry following the one with the index Index. If there is no * following code entry, return NULL. diff --git a/src/cc65/codeseg.h b/src/cc65/codeseg.h index dd9105c3a..1dc632638 100644 --- a/src/cc65/codeseg.h +++ b/src/cc65/codeseg.h @@ -107,6 +107,11 @@ void DelCodeEntry (CodeSeg* S, unsigned Index); * if the reference count drops to zero. */ +void DelCodeEntries (CodeSeg* S, unsigned Start, unsigned Count); +/* Delete a range of code entries. This includes removing references to labels, + * labels attached to the entries and so on. + */ + #if defined(HAVE_INLINE) INLINE struct CodeEntry* GetCodeEntry (CodeSeg* S, unsigned Index) /* Get an entry from the given code segment */ @@ -123,7 +128,7 @@ struct CodeEntry* GetNextCodeEntry (CodeSeg* S, unsigned Index); */ int GetCodeEntries (CodeSeg* S, struct CodeEntry** List, - unsigned Start, unsigned Count); + unsigned Start, unsigned Count); /* Get Count code entries into List starting at index start. Return true if * we got the lines, return false if not enough lines were available. */ -- 2.39.5