changeset 70070:9559d7f62131

(get_scrap_target_type_list, defer_apple_events) (copy_scrap_flavor_data, mac_handle_service_event): Don't check return value of xmalloc/xrealloc.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 18 Apr 2006 08:12:31 +0000
parents e82c1fc1df38
children 84e6726893ef
files src/macselect.c
diffstat 1 files changed, 12 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/macselect.c	Tue Apr 18 08:11:56 2006 +0000
+++ b/src/macselect.c	Tue Apr 18 08:12:31 2006 +0000
@@ -373,14 +373,11 @@
   err = GetScrapFlavorCount (scrap, &count);
   if (err == noErr)
     flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
-  if (flavor_info)
+  err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
+  if (err != noErr)
     {
-      err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
-      if (err != noErr)
-	{
-	  xfree (flavor_info);
-	  flavor_info = NULL;
-	}
+      xfree (flavor_info);
+      flavor_info = NULL;
     }
   if (flavor_info == NULL)
     count = 0;
@@ -1021,20 +1018,13 @@
 	  deferred_apple_events.count = 0;
 	  deferred_apple_events.buf =
 	    xmalloc (sizeof (AppleEvent) * deferred_apple_events.size);
-	  if (deferred_apple_events.buf == NULL)
-	    err = memFullErr;
 	}
       else if (deferred_apple_events.count == deferred_apple_events.size)
 	{
-	  AppleEvent *newbuf;
-
 	  deferred_apple_events.size *= 2;
-	  newbuf = xrealloc (deferred_apple_events.buf,
-			     sizeof (AppleEvent) * deferred_apple_events.size);
-	  if (newbuf)
-	    deferred_apple_events.buf = newbuf;
-	  else
-	    err = memFullErr;
+	  deferred_apple_events.buf
+	    = xrealloc (deferred_apple_events.buf,
+			sizeof (AppleEvent) * deferred_apple_events.size);
 	}
     }
 
@@ -1192,17 +1182,7 @@
 	  buf = NULL;
 	}
       else if (size_allocated < size)
-	{
-	  char *newbuf = xrealloc (buf, size);
-
-	  if (newbuf)
-	    buf = newbuf;
-	  else
-	    {
-	      xfree (buf);
-	      buf = NULL;
-	    }
-	}
+	buf = xrealloc (buf, size);
       else
 	break;
     }
@@ -1302,14 +1282,11 @@
 	err = GetScrapFlavorCount (cur_scrap, &count);
 	if (err == noErr)
 	  flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
-	if (flavor_info)
+	err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info);
+	if (err != noErr)
 	  {
-	    err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info);
-	    if (err != noErr)
-	      {
-		xfree (flavor_info);
-		flavor_info = NULL;
-	      }
+	    xfree (flavor_info);
+	    flavor_info = NULL;
 	  }
 	if (flavor_info == NULL)
 	  break;