diff options
author | ambrop7 <ambrop7@1a93d707-3861-5ebc-ad3b-9740d49b5140> | 2013-05-20 23:40:22 +0400 |
---|---|---|
committer | ambrop7 <ambrop7@1a93d707-3861-5ebc-ad3b-9740d49b5140> | 2013-05-20 23:40:22 +0400 |
commit | f5ea2bdef760ef862bcad8a665a047a5a9a184ee (patch) | |
tree | 5cf69b4418487095ca5903a850cd7800cadafd21 /structure | |
parent | a53724cfc530dda426a6657ac3fd9c933a4ae69f (diff) |
SLinkedList: implement MarkRemoved and IsRemoved
Diffstat (limited to 'structure')
-rw-r--r-- | structure/SLinkedList_decl.h | 2 | ||||
-rw-r--r-- | structure/SLinkedList_footer.h | 2 | ||||
-rw-r--r-- | structure/SLinkedList_header.h | 2 | ||||
-rw-r--r-- | structure/SLinkedList_impl.h | 14 |
4 files changed, 20 insertions, 0 deletions
diff --git a/structure/SLinkedList_decl.h b/structure/SLinkedList_decl.h index 06cde39..90d7e9e 100644 --- a/structure/SLinkedList_decl.h +++ b/structure/SLinkedList_decl.h @@ -43,6 +43,8 @@ typedef struct { static SLinkedListEntry * SLinkedListNext (SLinkedListEntry *entry); static SLinkedListEntry * SLinkedListPrev (SLinkedListEntry *entry); +static void SLinkedListMarkRemoved (SLinkedListEntry *entry); +static int SLinkedListIsRemoved (SLinkedListEntry *entry); static void SLinkedList_Init (SLinkedList *o); static void SLinkedList_Prepend (SLinkedList *o, SLinkedListEntry *entry); diff --git a/structure/SLinkedList_footer.h b/structure/SLinkedList_footer.h index e4498f6..9123d03 100644 --- a/structure/SLinkedList_footer.h +++ b/structure/SLinkedList_footer.h @@ -38,6 +38,8 @@ #undef SLinkedListNext #undef SLinkedListPrev +#undef SLinkedListMarkRemoved +#undef SLinkedListIsRemoved #undef SLinkedList_Init #undef SLinkedList_Prepend diff --git a/structure/SLinkedList_header.h b/structure/SLinkedList_header.h index 8fbf94e..41ffa37 100644 --- a/structure/SLinkedList_header.h +++ b/structure/SLinkedList_header.h @@ -41,6 +41,8 @@ // non-object public functions #define SLinkedListNext MERGE(SLinkedList, Next) #define SLinkedListPrev MERGE(SLinkedList, Prev) +#define SLinkedListMarkRemoved MERGE(SLinkedList, MarkRemoved) +#define SLinkedListIsRemoved MERGE(SLinkedList, IsRemoved) // public functions #define SLinkedList_Init MERGE(SLinkedList, _Init) diff --git a/structure/SLinkedList_impl.h b/structure/SLinkedList_impl.h index 0fbc646..1c6cff9 100644 --- a/structure/SLinkedList_impl.h +++ b/structure/SLinkedList_impl.h @@ -43,6 +43,20 @@ static SLinkedListEntry * SLinkedListPrev (SLinkedListEntry *entry) return SLinkedList_prev(entry); } +static void SLinkedListMarkRemoved (SLinkedListEntry *entry) +{ + ASSERT(entry) + + SLinkedList_next(entry) = entry; +} + +static int SLinkedListIsRemoved (SLinkedListEntry *entry) +{ + ASSERT(entry) + + return (entry == SLinkedList_next(entry)); +} + static void SLinkedList_Init (SLinkedList *o) { o->first = NULL; |