mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-05-26 21:37:59 -04:00
Drop "restrict" keyword
The "restrict" keyword can be used to indicate that no other pointer will be used to access a chunk of memory while the restricted pointer is alive. If that promise is not upheld, undefined behavior is triggered. It may be difficult to ensure this property, and the property may be brittle - becoming invalid as code evolves. Just like "inline", let's just leave optimizations up to the compiler to figure out.
This commit is contained in:
parent
3bd8f29b13
commit
7265a79e46
4 changed files with 14 additions and 14 deletions
|
|
@ -135,13 +135,13 @@ static bool is_taken(size_t n, const uint32_t arr[static n], uint32_t key) {
|
|||
*/
|
||||
struct match_state {
|
||||
const size_t num_conns;
|
||||
const uint32_t *restrict conns;
|
||||
const uint32_t *conns;
|
||||
const size_t num_crtcs;
|
||||
size_t score;
|
||||
size_t replaced;
|
||||
uint32_t *restrict res;
|
||||
uint32_t *restrict best;
|
||||
const uint32_t *restrict orig;
|
||||
uint32_t *res;
|
||||
uint32_t *best;
|
||||
const uint32_t *orig;
|
||||
bool exit_early;
|
||||
};
|
||||
|
||||
|
|
@ -236,9 +236,9 @@ static bool match_connectors_with_crtcs_(struct match_state *st,
|
|||
}
|
||||
|
||||
void match_connectors_with_crtcs(size_t num_conns,
|
||||
const uint32_t conns[static restrict num_conns],
|
||||
size_t num_crtcs, const uint32_t prev_crtcs[static restrict num_crtcs],
|
||||
uint32_t new_crtcs[static restrict num_crtcs]) {
|
||||
const uint32_t conns[static num_conns],
|
||||
size_t num_crtcs, const uint32_t prev_crtcs[static num_crtcs],
|
||||
uint32_t new_crtcs[static num_crtcs]) {
|
||||
uint32_t solution[num_crtcs];
|
||||
for (size_t i = 0; i < num_crtcs; ++i) {
|
||||
solution[i] = UNMATCHED;
|
||||
|
|
|
|||
|
|
@ -395,8 +395,8 @@ bool wlr_session_change_vt(struct wlr_session *session, unsigned vt) {
|
|||
|
||||
/* Tests if 'path' is KMS compatible by trying to open it. Returns the opened
|
||||
* device on success. */
|
||||
struct wlr_device *session_open_if_kms(struct wlr_session *restrict session,
|
||||
const char *restrict path) {
|
||||
struct wlr_device *session_open_if_kms(struct wlr_session *session,
|
||||
const char *path) {
|
||||
if (!path) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ void generate_cvt_mode(drmModeModeInfo *mode, int hdisplay, int vdisplay,
|
|||
* new_crtcs is populated with the new connector indices.
|
||||
*/
|
||||
void match_connectors_with_crtcs(size_t num_conns,
|
||||
const uint32_t conns[static restrict num_conns],
|
||||
size_t num_crtcs, const uint32_t prev_crtcs[static restrict num_crtcs],
|
||||
uint32_t new_crtcs[static restrict num_crtcs]);
|
||||
const uint32_t conns[static num_conns],
|
||||
size_t num_crtcs, const uint32_t prev_crtcs[static num_crtcs],
|
||||
uint32_t new_crtcs[static num_crtcs]);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ bool libseat_change_vt(struct wlr_session *base, unsigned vt);
|
|||
|
||||
void session_init(struct wlr_session *session);
|
||||
|
||||
struct wlr_device *session_open_if_kms(struct wlr_session *restrict session,
|
||||
const char *restrict path);
|
||||
struct wlr_device *session_open_if_kms(struct wlr_session *session,
|
||||
const char *path);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue