changeset 7515:d31babe815e7

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Mon, 16 May 1994 21:29:03 +0000
parents bdf8b696b76a
children bd6f993b61d8
files lwlib/lwlib.c
diffstat 1 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/lwlib.c	Mon May 16 20:47:35 1994 +0000
+++ b/lwlib/lwlib.c	Mon May 16 21:29:03 1994 +0000
@@ -28,18 +28,6 @@
 #include "lwlib-utils.h"
 #include <X11/StringDefs.h>
 
-#if defined(__GNUC__) && !defined(alloca)
-#define alloca __builtin_alloca
-#endif
-
-#if ((!__GNUC__) && !defined(__hpux)) && !defined(_AIX)
-#include <alloca.h>
-#endif
-
-#if defined(_AIX)
-#pragma alloca
-#endif
-
 #if defined (USE_LUCID)
 #include "lwlib-Xlw.h"
 #endif
@@ -73,6 +61,27 @@
 static void
 instanciate_widget_instance (/* widget_instance* instance */);
 
+lwlib_memset (address, value, length)
+     char *address;
+     int value;
+     int length;
+{
+  int i;
+
+  for (i = 0; i < length; i++)
+    address[i] = value;
+}
+
+lwlib_bcopy (from, to, length)
+     char *from;
+     char *to;
+     int length;
+{
+  int i;
+
+  for (i = 0; i < length; i++)
+    to[i] = from[i];
+}
 /* utility functions for widget_instance and widget_info */
 char *
 safe_strdup (s)
@@ -133,7 +142,7 @@
       wv = (widget_value *) malloc (sizeof (widget_value));
       malloc_cpt++;
     }
-  memset (wv, 0, sizeof (widget_value));
+  lwlib_memset (wv, 0, sizeof (widget_value));
   return wv;
 }
 
@@ -255,7 +264,7 @@
   safe_free_str (info->type);
   safe_free_str (info->name);
   free_widget_value_tree (info->val);
-  memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
+  lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
   free (info);
 }
 
@@ -297,7 +306,7 @@
 free_widget_instance (instance)
      widget_instance* instance;
 {
-  memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
+  lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
   free (instance);
 }
 
@@ -555,11 +564,13 @@
   else
     {
       int length = strlen (name) + 2;
-      char* real_name = (char *) alloca (length);
+      char* real_name = (char *) xmalloc (length);
       real_name [0] = '*';
       strcpy (real_name + 1, name);
       
       widget = XtNameToWidget (instance->widget, real_name);
+
+      free (real_name);
     }
   return widget;
 }