Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/lib/libc/stdio
On Sat, Oct 23, 2010 at 10:12:51AM -0400, Christos Zoulas wrote:
> Module Name: src
> Committed By: christos
> Date: Sat Oct 23 14:12:51 UTC 2010
>
> Modified Files:
> src/lib/libc/stdio: local.h
>
> Log Message:
> tell lint to shut up.
I'm sorry but this whole code is horrible. What is wrong with something
as simple as this?
Index: local.h
===================================================================
RCS file: /cvsroot/src/lib/libc/stdio/local.h,v
retrieving revision 1.28
diff -u -r1.28 local.h
--- local.h 23 Oct 2010 14:12:50 -0000 1.28
+++ local.h 23 Oct 2010 15:10:27 -0000
@@ -37,6 +37,8 @@
#include "wcio.h"
#include "fileext.h"
+#include <limits.h>
+
/*
* Information local to this implementation of stdio,
* in particular, macros and private variables.
@@ -117,5 +119,4 @@
/*
* Detect if the current file position fits in a long int.
*/
-#define _FPOS_OVERFLOW(pos) (/*CONSTCOND*/sizeof(fpos_t) > sizeof(long) && \
- ((pos) & (~0ULL << ((sizeof(fpos_t) - sizeof(long)) * NBBY))) != 0)
+#define _FPOS_OVERFLOW(pos) ((pos) < LONG_MIN || (pos) > LONG_MAX)
It works fine under NetBSD/i386 and builts fine for NetBSD/amd64.
And I would hope that the compiler is clever anough to optimize
the code away on 64bit platforms.
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
Home |
Main Index |
Thread Index |
Old Index