From 080d5b0432549af7739cab604315f08c41ee26a3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 24 Dec 2015 01:44:47 +0300 Subject: Add restrict keyword in textchunklist. --- src/gui/fonts/textchunklist.cpp | 20 ++++++++++---------- src/gui/fonts/textchunklist.h | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/gui/fonts/textchunklist.cpp b/src/gui/fonts/textchunklist.cpp index 24b46bea0..9458bf947 100644 --- a/src/gui/fonts/textchunklist.cpp +++ b/src/gui/fonts/textchunklist.cpp @@ -35,7 +35,7 @@ TextChunkList::TextChunkList() : void TextChunkList::insertFirst(TextChunk *const item) { - TextChunk *const oldFirst = start; + TextChunk *restrict const oldFirst = start; if (start) start->prev = item; item->prev = nullptr; @@ -54,15 +54,15 @@ void TextChunkList::moveToFirst(TextChunk *const item) if (item == start) return; - TextChunk *const oldPrev = item->prev; + TextChunk *restrict const oldPrev = item->prev; if (oldPrev) oldPrev->next = item->next; - TextChunk *const oldNext = item->next; + TextChunk *restrict const oldNext = item->next; if (oldNext) oldNext->prev = item->prev; else end = oldPrev; - TextChunk *const oldFirst = start; + TextChunk *restrict const oldFirst = start; if (start) start->prev = item; item->prev = nullptr; @@ -75,8 +75,8 @@ void TextChunkList::remove(const TextChunk *const item) if (!item) return; - TextChunk *const oldPrev = item->prev; - TextChunk *const oldNext = item->next; + TextChunk *restrict const oldPrev = item->prev; + TextChunk *restrict const oldNext = item->next; if (oldPrev) oldPrev->next = item->next; else @@ -94,7 +94,7 @@ void TextChunkList::remove(const TextChunk *const item) void TextChunkList::removeBack() { - TextChunk *oldEnd = end; + TextChunk *restrict oldEnd = end; if (oldEnd) { end = oldEnd->prev; @@ -112,7 +112,7 @@ void TextChunkList::removeBack() void TextChunkList::removeBack(int n) { - TextChunk *item = end; + TextChunk *restrict item = end; while (n && item) { n --; @@ -140,10 +140,10 @@ void TextChunkList::clear() { search.clear(); searchWidth.clear(); - TextChunk *item = start; + TextChunk *restrict item = start; while (item) { - TextChunk *const item2 = item->next; + TextChunk *restrict const item2 = item->next; delete item; item = item2; } diff --git a/src/gui/fonts/textchunklist.h b/src/gui/fonts/textchunklist.h index f1bfc3fe6..f9cf97b92 100644 --- a/src/gui/fonts/textchunklist.h +++ b/src/gui/fonts/textchunklist.h @@ -36,20 +36,20 @@ class TextChunkList final A_DELETE_COPY(TextChunkList) - void insertFirst(TextChunk *const item) A_NONNULL(2); + void insertFirst(TextChunk *restrict const item) restrict A_NONNULL(2); - void moveToFirst(TextChunk *const item) A_NONNULL(2); + void moveToFirst(TextChunk *restrict const item) restrict A_NONNULL(2); - void remove(const TextChunk *const item); + void remove(const TextChunk *restrict const item) restrict; - void removeBack(); + void removeBack() restrict; - void removeBack(int n); + void removeBack(int n) restrict; - void clear(); + void clear() restrict; - TextChunk *start; - TextChunk *end; + TextChunk *restrict start; + TextChunk *restrict end; uint32_t size; std::map search; std::map searchWidth; -- cgit v1.2.3-70-g09d2