Trailing whitespace deleted.
[bpt/emacs.git] / lwlib / lwlib-utils.c
index 97952af..3abff32 100644 (file)
@@ -3,33 +3,44 @@
 
 This file is part of the Lucid Widget Library.
 
-The Lucid Widget Library is free software; you can redistribute it and/or 
+The Lucid Widget Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 1, or (at your option)
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
+but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <memory.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* Definitions of these in config.h can cause
+   declaration conflicts later on between declarations for index
+   and declarations for strchr.  This file doesn't use
+   index and rindex, so cancel them.  */
+#undef index
+#undef rindex
+
+#include "../src/lisp.h"
 
 #include <X11/Xatom.h>
 #include <X11/IntrinsicP.h>
 #include <X11/ObjectP.h>
 #include "lwlib-utils.h"
+#include "lwlib.h"
 
 /* Redisplay the contents of the widget, without first clearing it. */
 void
-XtNoClearRefreshWidget (Widget widget)
+XtNoClearRefreshWidget (widget)
+     Widget widget;
 {
   XEvent event;
 
@@ -49,11 +60,14 @@ XtNoClearRefreshWidget (Widget widget)
 }
 
 
-/* 
+/*
  * Apply a function to all the subwidgets of a given widget recursively.
 */
 void
-XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
+XtApplyToWidgets (w, proc, arg)
+     Widget w;
+     XtApplyToWidgetsProc proc;
+     XtPointer arg;
 {
   if (XtIsComposite (w))
     {
@@ -64,7 +78,8 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
       int nkids = cw->composite.num_children;
       Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
       int i;
-      memcpy (kids, cw->composite.children, sizeof (Widget) * nkids);
+      lwlib_bcopy ((char *) cw->composite.children, (char *) kids,
+                  sizeof (Widget) * nkids);
       for (i = 0; i < nkids; i++)
 /* This prevent us from using gadgets, why is it here? */
 /*     if (XtIsWidget (kids [i])) */
@@ -83,7 +98,10 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
  * Stop as soon as the function returns non NULL and returns this as a value.
  */
 void *
-XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg)
+XtApplyUntilToWidgets (w, proc, arg)
+     Widget w;
+     XtApplyUntilToWidgetsProc proc;
+     XtPointer arg;
 {
   void* result;
   if (XtIsComposite (w))
@@ -109,7 +127,9 @@ XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg)
  * Returns a copy of the list of all children of a composite widget
  */
 Widget *
-XtCompositeChildren (Widget widget, unsigned int* number)
+XtCompositeChildren (widget, number)
+     Widget widget;
+     unsigned int* number;
 {
   CompositeWidget cw = (CompositeWidget)widget;
   Widget* result;
@@ -130,13 +150,15 @@ XtCompositeChildren (Widget widget, unsigned int* number)
 }
 
 Boolean
-XtWidgetBeingDestroyedP (Widget widget)
+XtWidgetBeingDestroyedP (widget)
+     Widget widget;
 {
   return widget->core.being_destroyed;
 }
 
 void
-XtSafelyDestroyWidget (Widget widget)
+XtSafelyDestroyWidget (widget)
+     Widget widget;
 {
 #if 0
 
@@ -155,7 +177,7 @@ XtSafelyDestroyWidget (Widget widget)
     }
   else
     XtDestroyWidget (widget);
-  
+
 #else
   abort ();
 #endif