Skip to content

Commit 7d1faca

Browse files
compnerdphausler
authored andcommitted
CFStorage: use the reserved spelling of restrict (#369)
`__restrict` is the reserved extension. It avoids the need for the use of the preprocesor on Windows, but has the same results on compilers which support restrict (though, some like MSVC support __restrict though not restrict).
1 parent e363489 commit 7d1faca

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

CoreFoundation/Collections.subproj/CFStorage.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@
4242
#endif
4343

4444
#if DEPLOYMENT_TARGET_WINDOWS
45-
// No C99 support
46-
#define restrict
47-
4845
// Replace bzero
4946
#define bzero(dst, size) ZeroMemory(dst, size)
50-
5147
#endif
5248

5349
#if !defined(PAGE_SIZE)
@@ -250,7 +246,7 @@ static inline void __CFStorageSetChild(CFStorageNode *parentNode, CFIndex childI
250246
__CFAssignWithWriteBarrier((void **)&parentNode->info.notLeaf.child[childIndex], newChild);
251247
}
252248

253-
static inline void __CFStorageGetChildren(const CFStorageNode *parent, CFStorageNode ** restrict resultArray, bool shouldRetain, bool shouldFreeze) {
249+
static inline void __CFStorageGetChildren(const CFStorageNode *parent, CFStorageNode ** __restrict resultArray, bool shouldRetain, bool shouldFreeze) {
254250
ASSERT(! parent->isLeaf);
255251
CFIndex i;
256252
for (i=0; i < 3; i++) {
@@ -278,7 +274,7 @@ CF_INLINE void __CFStorageSetCache(CFStorageRef storage, CFStorageNode *node, CF
278274
/* Gets the location for the specified absolute loc from the cached info.
279275
Returns NULL if the location is not in the cache.
280276
*/
281-
CF_INLINE uint8_t *__CFStorageGetFromCache(CFStorageRef storage, CFIndex loc, CFRange * restrict validConsecutiveValueRange, bool requireUnfrozenNode) {
277+
CF_INLINE uint8_t *__CFStorageGetFromCache(CFStorageRef storage, CFIndex loc, CFRange * __restrict validConsecutiveValueRange, bool requireUnfrozenNode) {
282278
CFStorageNode * const cachedNode = storage->cacheNode; /* It's important we read from this field no more than once, for thread safety with other concurrent reads; that is why the field is marked volatile. */
283279
if (! cachedNode) return NULL; /* No cache */
284280

@@ -313,7 +309,7 @@ CF_INLINE uint8_t *__CFStorageGetFromCache(CFStorageRef storage, CFIndex loc, CF
313309
relativeByteNum (not optional, for performance reasons) returns the relative byte number of the specified byte in the child.
314310
Don't call with leaf nodes!
315311
*/
316-
CF_INLINE CFStorageNode *__CFStorageFindChild(const CFStorageNode * restrict node, CFIndex byteNum, bool forInsertionOrDeletion, CFIndex * restrict childNum, CFIndex * restrict relativeByteNum) {
312+
CF_INLINE CFStorageNode *__CFStorageFindChild(const CFStorageNode * __restrict node, CFIndex byteNum, bool forInsertionOrDeletion, CFIndex * __restrict childNum, CFIndex * __restrict relativeByteNum) {
317313
if (forInsertionOrDeletion) byteNum--; /* If for insertion, we do <= checks, not <, so this accomplishes the same thing */
318314
CFStorageNode *result;
319315
result = node->info.notLeaf.child[0];

0 commit comments

Comments
 (0)