Skip to content

Commit

Permalink
Misc: Modify function attributes
Browse files Browse the repository at this point in the history
 - Remove the const function attribute from get_time_*(), since the
   functions they call that actually get the time probably access global
   variables or have other behaviors unacceptable for const functions.

 - Change the const function attribute on win_has_frame() to pure, as it
   accesses memory its parameter points to, which is invalid for a const
   function.
  • Loading branch information
richardgv committed Sep 6, 2015
1 parent c156abb commit 20e9964
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ timespec_subtract(struct timespec *result,
/**
* Get current time in struct timeval.
*/
static inline struct timeval __attribute__((const))
static inline struct timeval
get_time_timeval(void) {
struct timeval tv = { 0, 0 };

Expand All @@ -1490,7 +1490,7 @@ get_time_timeval(void) {
*
* Note its starting time is unspecified.
*/
static inline struct timespec __attribute__((const))
static inline struct timespec
get_time_timespec(void) {
struct timespec tm = { 0, 0 };

Expand Down
2 changes: 1 addition & 1 deletion src/compton.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ update_reg_ignore_expire(session_t *ps, const win *w) {
/**
* Check whether a window has WM frames.
*/
static inline bool __attribute__((const))
static inline bool __attribute__((pure))
win_has_frame(const win *w) {
return w->a.border_width
|| w->frame_extents.top || w->frame_extents.left
Expand Down

0 comments on commit 20e9964

Please sign in to comment.