lkml.org 
[lkml]   [2006]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Some const for linux/time.h
Hello,


time compare functions do not modify their arguments, so they can
be marked as const (like some of the functions in time.h are already).

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>

diff --fast -Ndpru linux-2.6.17.7~/include/linux/time.h linux-2.6.17.7+/include/linux/time.h
--- linux-2.6.17.7~/include/linux/time.h 2006-06-06 02:57:02.000000000 +0200
+++ linux-2.6.17.7+/include/linux/time.h 2006-07-27 22:35:53.308571000 +0200
@@ -33,7 +33,8 @@ struct timezone {
#define NSEC_PER_SEC 1000000000L
#define NSEC_PER_USEC 1000L

-static inline int timespec_equal(struct timespec *a, struct timespec *b)
+static inline int timespec_equal(const struct timespec *a,
+ const struct timespec *b)
{
return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
}
@@ -43,7 +44,8 @@ static inline int timespec_equal(struct
* lhs == rhs: return 0
* lhs > rhs: return >0
*/
-static inline int timespec_compare(struct timespec *lhs, struct timespec *rhs)
+static inline int timespec_compare(const struct timespec *lhs,
+ struct timespec *rhs)
{
if (lhs->tv_sec < rhs->tv_sec)
return -1;
@@ -52,7 +54,8 @@ static inline int timespec_compare(struc
return lhs->tv_nsec - rhs->tv_nsec;
}

-static inline int timeval_compare(struct timeval *lhs, struct timeval *rhs)
+static inline int timeval_compare(const struct timeval *lhs,
+ const struct timeval *rhs)
{
if (lhs->tv_sec < rhs->tv_sec)
return -1;
#<<eof>>

Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-27 22:43    [W:0.049 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site