From 21c1cc98d8210a3ce2a4bf62ecee9168fdd99dcb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 2 Feb 2011 22:42:13 -0800 Subject: Remove unused #ifdef UNALIGNED version of Xt macros & functions 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 --- include/X11/IntrinsicI.h | 33 ------------------ src/Resources.c | 87 ------------------------------------------------ 2 files changed, 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 -/* 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) -- cgit v1.2.3