]> git.eshelyaron.com Git - emacs.git/commitdiff
Use xmalloc instead of malloc.
authorJan D <jan.h.d@swipnet.se>
Mon, 31 Jan 2011 06:44:05 +0000 (07:44 +0100)
committerJan D <jan.h.d@swipnet.se>
Mon, 31 Jan 2011 06:44:05 +0000 (07:44 +0100)
* lwlib-Xm.c (make_destroyed_instance):
* lwlib-utils.c (XtApplyToWidgets):
* lwlib.c (safe_strdup, malloc_widget_value)
(allocate_widget_info, allocate_widget_instance): Use xmalloc
instead of malloc.

lwlib/ChangeLog
lwlib/lwlib-Xm.c
lwlib/lwlib-utils.c
lwlib/lwlib.c

index 5015f2b8fa11bddab488464c0eeae015bf097f3b..450ede33a50681d82361bd6b78ec0554d18cad80 100644 (file)
@@ -1,3 +1,11 @@
+2011-01-31  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * lwlib-Xm.c (make_destroyed_instance):
+       * lwlib-utils.c (XtApplyToWidgets):
+       * lwlib.c (safe_strdup, malloc_widget_value)
+       (allocate_widget_info, allocate_widget_instance): Use xmalloc
+       instead of malloc.
+
 2011-01-25  Werner Meisner  <weme24@gmx.net>
 
        * lwlib-Xm.c (xm_update_menu): Avoid a NULL pointer dereference
index 14d1c03c4a32104be0e4730a1beed5a1707c7a3b..059cf10d2bb947e9e0f0646e65b3083c003f08a3 100644 (file)
@@ -173,7 +173,7 @@ make_destroyed_instance (char* name,
                          Boolean pop_up_p)
 {
   destroyed_instance* instance =
-    (destroyed_instance*)malloc (sizeof (destroyed_instance));
+    (destroyed_instance*) xmalloc (sizeof (destroyed_instance));
   instance->name = safe_strdup (name);
   instance->type = safe_strdup (type);
   instance->widget = widget;
index 4e095d33fad5a55e227540e1df640fcd49380857..30f4f94f3769d8d48359d141d229ee002634fd87 100644 (file)
@@ -74,7 +74,7 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
         the procedure might add/delete elements, which would lose badly.
         */
       int nkids = cw->composite.num_children;
-      Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
+      Widget *kids = (Widget *) xmalloc (sizeof (Widget) * nkids);
       int i;
       memcpy ((char *) kids, (char *) cw->composite.children,
              sizeof (Widget) * nkids);
index 677516a6b1c842a993c1b462de92372679b23f4b..e03196d79275d12b1a8f12188efa35c1f78850cf 100644 (file)
@@ -109,9 +109,7 @@ safe_strdup (const char *s)
 {
   char *result;
   if (! s) return 0;
-  result = (char *) malloc (strlen (s) + 1);
-  if (! result)
-    return 0;
+  result = (char *) xmalloc (strlen (s) + 1);
   strcpy (result, s);
   return result;
 }
@@ -157,7 +155,7 @@ malloc_widget_value (void)
     }
   else
     {
-      wv = (widget_value *) malloc (sizeof (widget_value));
+      wv = (widget_value *) xmalloc (sizeof (widget_value));
       malloc_cpt++;
     }
   memset ((void*) wv, 0, sizeof (widget_value));
@@ -257,7 +255,7 @@ allocate_widget_info (const char* type,
                       lw_callback post_activate_cb,
                       lw_callback highlight_cb)
 {
-  widget_info* info = (widget_info*)malloc (sizeof (widget_info));
+  widget_info* info = (widget_info*) xmalloc (sizeof (widget_info));
   info->type = safe_strdup (type);
   info->name = safe_strdup (name);
   info->id = id;
@@ -299,7 +297,7 @@ static widget_instance *
 allocate_widget_instance (widget_info* info, Widget parent, Boolean pop_up_p)
 {
   widget_instance* instance =
-    (widget_instance*)malloc (sizeof (widget_instance));
+    (widget_instance*) xmalloc (sizeof (widget_instance));
   memset (instance, 0, sizeof *instance);
   instance->parent = parent;
   instance->pop_up_p = pop_up_p;