Skip to content

Commit 3c8da57

Browse files
committed
Make zend_atomic_bool_load() function signature static
1 parent 2b8ba99 commit 3c8da57

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

Zend/zend_atomic.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired) {
3535
zend_atomic_bool_store_ex(obj, desired);
3636
}
3737

38-
#if ZEND_WIN32 || HAVE_SYNC_ATOMICS
39-
/* On these platforms it is non-const due to underlying APIs. */
40-
ZEND_API bool zend_atomic_bool_load(zend_atomic_bool *obj) {
41-
return zend_atomic_bool_load_ex(obj);
42-
}
43-
#else
4438
ZEND_API bool zend_atomic_bool_load(const zend_atomic_bool *obj) {
4539
return zend_atomic_bool_load_ex(obj);
4640
}
47-
#endif

Zend/zend_atomic.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob
5858
return InterlockedExchange8(&obj->value, desired);
5959
}
6060

61-
/* On this platform it is non-const due to Iterlocked API*/
62-
static zend_always_inline bool zend_atomic_bool_load_ex(zend_atomic_bool *obj) {
61+
static zend_always_inline bool zend_atomic_bool_load_ex(const zend_atomic_bool *obj) {
6362
/* Or'ing with false won't change the value. */
64-
return InterlockedOr8(&obj->value, false);
63+
return InterlockedOr8(&((zend_atomic_bool *) obj)->value, false);
6564
}
6665

6766
static zend_always_inline void zend_atomic_bool_store_ex(zend_atomic_bool *obj, bool desired) {
@@ -118,9 +117,9 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob
118117
return prev;
119118
}
120119

121-
static zend_always_inline bool zend_atomic_bool_load_ex(zend_atomic_bool *obj) {
120+
static zend_always_inline bool zend_atomic_bool_load_ex(const zend_atomic_bool *obj) {
122121
/* Or'ing false won't change the value */
123-
return __sync_fetch_and_or(&obj->value, false);
122+
return __sync_fetch_and_or(&((zend_atomic_bool *) obj)->value, false);
124123
}
125124

126125
static zend_always_inline void zend_atomic_bool_store_ex(zend_atomic_bool *obj, bool desired) {
@@ -154,13 +153,7 @@ static zend_always_inline bool zend_atomic_bool_exchange_ex(zend_atomic_bool *ob
154153
ZEND_API void zend_atomic_bool_init(zend_atomic_bool *obj, bool desired);
155154
ZEND_API bool zend_atomic_bool_exchange(zend_atomic_bool *obj, bool desired);
156155
ZEND_API void zend_atomic_bool_store(zend_atomic_bool *obj, bool desired);
157-
158-
#if ZEND_WIN32 || HAVE_SYNC_ATOMICS
159-
/* On these platforms it is non-const due to underlying APIs. */
160-
ZEND_API bool zend_atomic_bool_load(zend_atomic_bool *obj);
161-
#else
162156
ZEND_API bool zend_atomic_bool_load(const zend_atomic_bool *obj);
163-
#endif
164157

165158
END_EXTERN_C()
166159

0 commit comments

Comments
 (0)