Misc: Modify function attributes

- 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.
This commit is contained in:
Richard Grenville 2015-09-06 22:32:52 +08:00
parent c156abb0e8
commit 20e996494b
2 changed files with 3 additions and 3 deletions

View File

@ -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 };
@ -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 };

View File

@ -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