emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103044: Use xmalloc instead of mallo


From: Jan D
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103044: Use xmalloc instead of malloc.
Date: Mon, 31 Jan 2011 07:44:05 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103044
committer: Jan D <address@hidden>
branch nick: trunk
timestamp: Mon 2011-01-31 07:44:05 +0100
message:
  Use xmalloc instead of malloc.
  
  * 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.
modified:
  lwlib/ChangeLog
  lwlib/lwlib-Xm.c
  lwlib/lwlib-utils.c
  lwlib/lwlib.c
=== modified file 'lwlib/ChangeLog'
--- a/lwlib/ChangeLog   2011-01-25 04:08:28 +0000
+++ b/lwlib/ChangeLog   2011-01-31 06:44:05 +0000
@@ -1,3 +1,11 @@
+2011-01-31  Jan Djärv  <address@hidden>
+
+       * 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  <address@hidden>
 
        * lwlib-Xm.c (xm_update_menu): Avoid a NULL pointer dereference

=== modified file 'lwlib/lwlib-Xm.c'
--- a/lwlib/lwlib-Xm.c  2011-01-26 08:36:39 +0000
+++ b/lwlib/lwlib-Xm.c  2011-01-31 06:44:05 +0000
@@ -173,7 +173,7 @@
                          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;

=== modified file 'lwlib/lwlib-utils.c'
--- a/lwlib/lwlib-utils.c       2011-01-25 04:08:28 +0000
+++ b/lwlib/lwlib-utils.c       2011-01-31 06:44:05 +0000
@@ -74,7 +74,7 @@
         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);

=== modified file 'lwlib/lwlib.c'
--- a/lwlib/lwlib.c     2011-01-25 04:08:28 +0000
+++ b/lwlib/lwlib.c     2011-01-31 06:44:05 +0000
@@ -109,9 +109,7 @@
 {
   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 @@
     }
   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 @@
                       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 @@
 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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]