Re: [PATCH -mm] LZO: Further cleanup of the kernel LZO library headers

2007-05-18 Thread Heikki Orsila
On Fri, May 18, 2007 at 03:51:26PM +0100, Richard Purdie wrote:
> A further cleanup of the kernel LZO library headers which untangles and
> removes ~400 lines of defines. This doesn't change the core minilzo code
> so diffability is maintained.

You should just throw away that. Guptas implementation is much cleaner, 
work with that. Putting a few bound checks into Guptas version will 
solve crashes and overruns by returning an error.

-- 
Heikki Orsila   Barbie's law:
[EMAIL PROTECTED]   "Math is hard, let's go shopping!"
http://www.iki.fi/shd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm] LZO: Further cleanup of the kernel LZO library headers

2007-05-18 Thread Richard Purdie
A further cleanup of the kernel LZO library headers which untangles and
removes ~400 lines of defines. This doesn't change the core minilzo code
so diffability is maintained.

Signed-off-by: Richard Purdie <[EMAIL PROTECTED]>

---
 lib/lzo/lzoconf.h |   96 +---
 lib/lzo/lzodefs.h |  412 +-
 lib/lzo/minilzo.c |   53 --
 3 files changed, 88 insertions(+), 473 deletions(-)

As an aside, diffing minilzo.c with its userspace counterpart:

 minilzo.c | 2158 --
 1 file changed, 29 insertions(+), 2129 deletions(-)


Index: linux-2.6.21/lib/lzo/lzoconf.h
===
--- linux-2.6.21.orig/lib/lzo/lzoconf.h 2007-05-16 18:46:03.0 +0100
+++ linux-2.6.21/lib/lzo/lzoconf.h  2007-05-18 15:30:37.0 +0100
@@ -29,86 +29,38 @@
  */
 
 
-#ifndef __LZOCONF_H_INCLUDED
-#define __LZOCONF_H_INCLUDED
-
-
 #define LZO_VERSION 0x2020
 #define LZO_VERSION_STRING  "2.02"
 #define LZO_VERSION_DATE"Oct 17 2005"
 
 #define USHRT_MAX 0x
-#define LZO_EXTERN(t) t
 
 #include "lzodefs.h"
 
-
-/***
-// some core defines
-/
-
-#if !defined(LZO_UINT32_C)
-#  if (UINT_MAX < LZO_0xL)
-#define LZO_UINT32_C(c) c ## UL
-#  else
-#define LZO_UINT32_C(c) ((c) + 0U)
-#  endif
-#endif
-
-/* memory checkers */
-#if !defined(__LZO_CHECKER)
-#  if defined(__BOUNDS_CHECKING_ON)
-#define __LZO_CHECKER   1
-#  elif defined(__CHECKER__)
-#define __LZO_CHECKER   1
-#  elif defined(__INSURE__)
-#define __LZO_CHECKER   1
-#  elif defined(__PURIFY__)
-#define __LZO_CHECKER   1
-#  endif
-#endif
-
-
-/***
-// integral and pointer types
-/
-
 /* lzo_uint should match size_t */
-#if !defined(LZO_UINT_MAX)
-#  if defined(LZO_ABI_IP32L64) /* MIPS R5900 */
+#if defined(LZO_ABI_IP32L64) /* MIPS R5900 */
  typedef unsigned int   lzo_uint;
  typedef intlzo_int;
-#define LZO_UINT_MAXUINT_MAX
-#define LZO_INT_MAX INT_MAX
-#define LZO_INT_MIN INT_MIN
-#  elif (ULONG_MAX >= LZO_0xL)
+#  define LZO_UINT_MAXUINT_MAX
+#elif (ULONG_MAX >= LZO_0xL)
  typedef unsigned long  lzo_uint;
  typedef long   lzo_int;
-#define LZO_UINT_MAXULONG_MAX
-#define LZO_INT_MAX LONG_MAX
-#define LZO_INT_MIN LONG_MIN
-#  else
-#error "lzo_uint"
-#  endif
+#  define LZO_UINT_MAXULONG_MAX
+#else
+#  error "lzo_uint"
 #endif
 
 /* Integral types with 32 bits or more. */
-#if !defined(LZO_UINT32_MAX)
-#  if (UINT_MAX >= LZO_0xL)
+#if (UINT_MAX >= LZO_0xL)
  typedef unsigned int   lzo_uint32;
  typedef intlzo_int32;
-#define LZO_UINT32_MAX  UINT_MAX
-#define LZO_INT32_MAX   INT_MAX
-#define LZO_INT32_MIN   INT_MIN
-#  elif (ULONG_MAX >= LZO_0xL)
+#  define LZO_UINT32_MAX  UINT_MAX
+#elif (ULONG_MAX >= LZO_0xL)
  typedef unsigned long  lzo_uint32;
  typedef long   lzo_int32;
-#define LZO_UINT32_MAX  ULONG_MAX
-#define LZO_INT32_MAX   LONG_MAX
-#define LZO_INT32_MIN   LONG_MIN
-#  else
-#error "lzo_uint32"
-#  endif
+#  define LZO_UINT32_MAX  ULONG_MAX
+#else
+#  error "lzo_uint32"
 #endif
 
 /* The larger type of lzo_uint and lzo_uint32. */
@@ -131,31 +83,10 @@
 #define lzo_xintp   lzo_xint *
 #define lzo_voidpp  lzo_voidp *
 #define lzo_bytepp  lzo_bytep *
-/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
-#define lzo_byteunsigned char
-
-typedef int lzo_bool;
-
-
-/***
-// function types
-/
 
-/* name mangling */
-#define __LZO_EXTERN_C  extern
 
-/* __cdecl calling convention for public C and assembly functions */
-#if !defined(LZO_PUBLIC)
-#  define LZO_PUBLIC(_rettype)  _rettype
-#endif
-#if !defined(LZO_EXTERN)
-#  define LZO_EXTERN(_rettype)  __LZO_EXTERN_C LZO_PUBLIC(_rettype)
-#endif
-#if !defined(LZO_PRIVATE)
-#  define LZO_PRIVATE(_rettype) static _rettype
-#endif
+#define LZO_PUBLIC(_rettype)  _rettype
 
-/* function types */
 typedef int
 (*lzo_compress_t)   ( const lzo_bytep src, lzo_uint  src_len,
 lzo_bytep dst, lzo_uintp dst_len,
@@ -183,4 +114,3 @@ typedef int
lzo_voidp wrkmem,
  const lzo_bytep dict, lzo_uint dict_len )