[PATCH:libXt 1/3] Remove unused #ifdef UNALIGNED version of Xt macros & functions

Alan Coopersmith alan.coopersmith at oracle.com
Fri Feb 4 22:29:58 PST 2011


Trying to outsmart the compiler and libc is a losing battle, but
since UNALIGNED was never defined, we weren't even trying.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 include/X11/IntrinsicI.h |   33 -----------------
 src/Resources.c          |   87 ----------------------------------------------
 2 files changed, 0 insertions(+), 120 deletions(-)

diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h
index 26d6036..845ab48 100644
--- a/include/X11/IntrinsicI.h
+++ b/include/X11/IntrinsicI.h
@@ -108,37 +108,6 @@ SOFTWARE.
 #define _XBCOPYFUNC _XtBcopy
 #include <X11/Xfuncs.h>
 
-/* If the alignment characteristics of your machine are right, these may be
-   faster */
-
-#ifdef UNALIGNED
-
-#define XtMemmove(dst, src, size)			    \
-    if ((char *)(dst) != (char *)(src)) {		    \
-	if (size == sizeof(int))			    \
-	    *((int *) (dst)) = *((int *) (src));	    \
-	else if (size == sizeof(char))			    \
-	    *((char *) (dst)) = *((char *) (src));	    \
-	else if (size == sizeof(short))			    \
-	    *((short *) (dst)) = *((short *) (src));	    \
-	else						    \
-	    (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
-    }
-
-#define XtBZero(dst, size)				    \
-    if (size == sizeof(int))				    \
-	*((int *) (dst)) = 0;				    \
-    else						    \
-	bzero((char *) (dst), (int) (size))
-
-#define XtMemcmp(b1, b2, size)				    \
-    (size == sizeof(int) ?				    \
-	*((int *) (b1)) != *((int *) (b2))		    \
-    :   memcmp((char *) (b1), (char *) (b2), (int) (size))  \
-    )
-
-#else
-
 #define XtMemmove(dst, src, size)	\
     if ((char *)(dst) != (char *)(src)) {		    \
 	(void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
@@ -150,8 +119,6 @@ SOFTWARE.
 #define XtMemcmp(b1, b2, size) 		\
 	memcmp((char *) (b1), (char *) (b2), (int) (size))
 
-#endif
-
 
 /****************************************************************
  *
diff --git a/src/Resources.c b/src/Resources.c
index 67d6860..304d3d5 100644
--- a/src/Resources.c
+++ b/src/Resources.c
@@ -109,92 +109,6 @@ void _XtCopyFromParent(
 } /* _XtCopyFromParent */
 
 
-/* If the alignment characteristics of your machine are right, these may be
-   faster */
-
-#ifdef UNALIGNED
-
-void _XtCopyFromArg(
-    XtArgVal src,
-    char* dst,
-    register unsigned int size)
-{
-    if	    (size == sizeof(long))	*(long *)dst = (long)src;
-    else if (size == sizeof(short))	*(short *)dst = (short)src;
-    else if (size == sizeof(char))	*(char *)dst = (char)src;
-    else if (size == sizeof(XtPointer))	*(XtPointer *)dst = (XtPointer)src;
-    else if (size == sizeof(char*))	*(char **)dst = (char*)src;
-    else if (size == sizeof(XtArgVal))	*(XtArgVal *)dst = src;
-    else if (size > sizeof(XtArgVal))
-	(void) memmove((char *) dst, (char *)  src, (int) size);
-    else
-	(void) memmove((char *) dst, (char *) &src, (int) size);
-} /* _XtCopyFromArg */
-
-void _XtCopyToArg(
-    char* src,
-    XtArgVal *dst,
-    register unsigned int size)
-{
-    if (! (*dst)) {
-#ifdef GETVALUES_BUG
-	/* old GetValues semantics (storing directly into arglists) are bad,
-	 * but preserve for compatibility as long as arglist contains NULL.
-	 */
-        if	(size == sizeof(long))	   *dst = (XtArgVal)*(long*)src;
-	else if (size == sizeof(short))    *dst = (XtArgVal)*(short*)src;
-	else if (size == sizeof(char))	   *dst = (XtArgVal)*(char*)src;
-	else if (size == sizeof(XtPointer)) *dst = (XtArgVal)*(XtPointer*)src;
-	else if (size == sizeof(char*))    *dst = (XtArgVal)*(char**)src;
-	else if (size == sizeof(XtArgVal)) *dst = *(XtArgVal*)src;
-	else (void) memmove((char*)dst, (char*)src, (int)size);
-#else
-	XtErrorMsg("invalidGetValues", "xtGetValues", XtCXtToolkitError,
-	    "NULL ArgVal in XtGetValues", (String*) NULL, (Cardinal*) NULL);
-#endif
-    }
-    else {
-	/* proper GetValues semantics: argval is pointer to destination */
-	if	(size == sizeof(long))	   *((long*)*dst) = *(long*)src;
-	else if (size == sizeof(short))    *((short*)*dst) = *(short*)src;
-	else if (size == sizeof(char))	   *((char*)*dst) = *(char*)src;
-	else if (size == sizeof(XtPointer)) *((XtPointer*)*dst) = *(XtPointer*)src;
-	else if (size == sizeof(char*))    *((char**)*dst) = *(char**)src;
-	else if (size == sizeof(XtArgVal)) *((XtArgVal*)*dst)= *(XtArgVal*)src;
-	else (void) memmove((char*)*dst, (char*)src, (int)size);
-    }
-} /* _XtCopyToArg */
-
-static void CopyToArg(
-    char* src,
-    XtArgVal *dst,
-    register unsigned int size)
-{
-    if (! (*dst)) {
-	/* old GetValues semantics (storing directly into arglists) are bad,
-	 * but preserve for compatibility as long as arglist contains NULL.
-	 */
-        if	(size == sizeof(long))	   *dst = (XtArgVal)*(long*)src;
-	else if (size == sizeof(short))    *dst = (XtArgVal)*(short*)src;
-	else if (size == sizeof(char))	   *dst = (XtArgVal)*(char*)src;
-	else if (size == sizeof(XtPointer)) *dst = (XtArgVal)*(XtPointer*)src;
-	else if (size == sizeof(char*))    *dst = (XtArgVal)*(char**)src;
-	else if (size == sizeof(XtArgVal)) *dst = *(XtArgVal*)src;
-	else (void) memmove((char*)dst, (char*)src, (int)size);
-    }
-    else {
-	/* proper GetValues semantics: argval is pointer to destination */
-	if	(size == sizeof(long))	   *((long*)*dst) = *(long*)src;
-	else if (size == sizeof(short))    *((short*)*dst) = *(short*)src;
-	else if (size == sizeof(char))	   *((char*)*dst) = *(char*)src;
-	else if (size == sizeof(XtPointer)) *((XtPointer*)*dst) = *(XtPointer*)src;
-	else if (size == sizeof(char*))    *((char**)*dst) = *(char**)src;
-	else if (size == sizeof(XtArgVal)) *((XtArgVal*)*dst)= *(XtArgVal*)src;
-	else (void) memmove((char*)*dst, (char*)src, (int)size);
-    }
-} /* CopyToArg */
-
-#else
 void _XtCopyFromArg(
     XtArgVal src,
     char* dst,
@@ -313,7 +227,6 @@ static void CopyToArg(
     }
 } /* CopyToArg */
 
-#endif
 
 static Cardinal CountTreeDepth(
     Widget w)
-- 
1.7.3.2



More information about the xorg-devel mailing list