$NetBSD: patch-aj,v 1.5 2024/10/01 10:56:41 nia Exp $

--- glib.h.orig	2001-02-27 03:44:38.000000000 +0000
+++ glib.h
@@ -119,8 +119,12 @@ extern "C" {
  *  defined then the current definition is correct.
  */
 #ifndef	NULL
+#ifdef		__cplusplus
+#define	NULL	(0L)
+#else
 #define	NULL	((void*) 0)
 #endif
+#endif
 
 #ifndef	FALSE
 #define	FALSE	(0)
@@ -204,7 +208,7 @@ extern "C" {
 #ifndef G_INLINE_FUNC
 #  ifdef __GNUC__
 #    ifdef __OPTIMIZE__
-#      define G_INLINE_FUNC extern inline
+#      define G_INLINE_FUNC static inline
 #    else
 #      undef G_CAN_INLINE
 #      define G_INLINE_FUNC extern
@@ -271,14 +275,18 @@ extern "C" {
 
 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
  * macros, so we can refer to them as strings unconditionally.
+ *
+ * NB: GLib requires that these expand to string literals so that
+ * they're concatenable. Therefore, they're only useful for GCC < 3.0
+ * because since GCC 3.0 these macros expand to const pointers.
  */
-#ifdef	__GNUC__
+#if defined(__GNUC__) && (__GNUC__ < 3)
 #define	G_GNUC_FUNCTION		__FUNCTION__
 #define	G_GNUC_PRETTY_FUNCTION	__PRETTY_FUNCTION__
-#else	/* !__GNUC__ */
+#else /* !(__GNUC__ < 3) */
 #define	G_GNUC_FUNCTION		""
 #define	G_GNUC_PRETTY_FUNCTION	""
-#endif	/* !__GNUC__ */
+#endif        /* !(__GNUC__ < 3) */
 
 /* we try to provide a usefull equivalent for ATEXIT if it is
  * not defined, but use is actually abandoned. people should
@@ -526,51 +534,8 @@ typedef gint32	GTime;
     (((guint32) (val) & (guint32) 0x00ff0000U) >>  8) | \
     (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
 
-/* Intel specific stuff for speed
- */
-#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
-#  define GUINT16_SWAP_LE_BE_X86(val) \
-     (__extension__					\
-      ({ register guint16 __v;				\
-	 if (__builtin_constant_p (val))		\
-	   __v = GUINT16_SWAP_LE_BE_CONSTANT (val);	\
-	 else						\
-	   __asm__ __const__ ("rorw $8, %w0"		\
-			      : "=r" (__v)		\
-			      : "0" ((guint16) (val)));	\
-	__v; }))
-#  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
-#  if !defined(__i486__) && !defined(__i586__) \
-      && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
-#     define GUINT32_SWAP_LE_BE_X86(val) \
-        (__extension__						\
-         ({ register guint32 __v;				\
-	    if (__builtin_constant_p (val))			\
-	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
-	  else							\
-	    __asm__ __const__ ("rorw $8, %w0\n\t"		\
-			       "rorl $16, %0\n\t"		\
-			       "rorw $8, %w0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
-	__v; }))
-#  else /* 486 and higher has bswap */
-#     define GUINT32_SWAP_LE_BE_X86(val) \
-        (__extension__						\
-         ({ register guint32 __v;				\
-	    if (__builtin_constant_p (val))			\
-	      __v = GUINT32_SWAP_LE_BE_CONSTANT (val);		\
-	  else							\
-	    __asm__ __const__ ("bswap %0"			\
-			       : "=r" (__v)			\
-			       : "0" ((guint32) (val)));	\
-	__v; }))
-#  endif /* processor specific 32-bit stuff */
-#  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
-#else /* !__i386__ */
 #  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
 #  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
-#endif /* __i386__ */
 
 #ifdef G_HAVE_GINT64
 #  define GUINT64_SWAP_LE_BE_CONSTANT(val)	((guint64) ( \
@@ -590,26 +555,7 @@ typedef gint32	GTime;
 	(guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) |	\
       (((guint64) (val) &						\
 	(guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
-#  if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
-#    define GUINT64_SWAP_LE_BE_X86(val) \
-	(__extension__						\
-	 ({ union { guint64 __ll;				\
-		    guint32 __l[2]; } __r;			\
-	    if (__builtin_constant_p (val))			\
-	      __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (val);	\
-	    else						\
-	      {							\
-	 	union { guint64 __ll;				\
-			guint32 __l[2]; } __w;			\
-		__w.__ll = ((guint64) val);			\
-		__r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]);	\
-		__r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]);	\
-	      }							\
-	  __r.__ll; }))
-#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
-#  else /* !__i386__ */
 #    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
-#  endif
 #endif
 
 #define GUINT16_SWAP_LE_PDP(val)	((guint16) (val))
