Re: [1/2] use const in time.h unit conversion functions

From: Matt Mackall
Date: Wed Jun 02 2004 - 13:48:39 EST


On Tue, Jun 01, 2004 at 06:24:29PM -0700, William Lee Irwin III wrote:
> On Tue, Jun 01, 2004 at 02:15:39AM -0700, Andrew Morton wrote:
> > - NFS server udpates
> > - md updates
> > - big x86 dmi_scan.c cleanup
> > - merged perfctr. No documentation though :(
> > - cris architecture update
>
> The time conversion functions may have const args, which is in fact
> useful for when they are passed const variables as arguments so as
> to avoid discarding qualifiers from pointer types warnings. This is
> a preparatory cleanup for a minor aio bugfix.
>
> Index: timer-2.6.7-rc2/include/linux/time.h
> ===================================================================
> +++ timer-2.6.7-rc2/include/linux/time.h 2004-06-01 16:02:01.000000000 -0700
> @@ -184,7 +184,7 @@
> * Avoid unnecessary multiplications/divisions in the
> * two most common HZ cases:
> */
> -static inline unsigned int jiffies_to_msecs(unsigned long j)
> +static inline unsigned int jiffies_to_msecs(const unsigned long j)

Does this actually do something meaningful? This stuff gets passed by value.

This is the second const-correctness patch I've seen in a couple days,
and I'd like to point out that while it's a noble cause, retrofitting
const decls onto interfaces is notorious for causing ripple effects in
APIs.

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