From: YAMAMOTO Mitsuharu Date: Tue, 18 Apr 2006 08:12:31 +0000 (+0000) Subject: (get_scrap_target_type_list, defer_apple_events) X-Git-Tag: emacs-pretest-22.0.90~3095 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1091c0b3cc5b4b17f3d046390c4e037d9363f80b;p=emacs.git (get_scrap_target_type_list, defer_apple_events) (copy_scrap_flavor_data, mac_handle_service_event): Don't check return value of xmalloc/xrealloc. --- diff --git a/src/macselect.c b/src/macselect.c index 8312197181f..fe4a7c8eccc 100644 --- a/src/macselect.c +++ b/src/macselect.c @@ -373,14 +373,11 @@ get_scrap_target_type_list (scrap) 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 @@ defer_apple_events (apple_event, reply) 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 @@ copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) 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 @@ mac_handle_service_event (call_ref, event, data) 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;