Mercurial > emacs
changeset 70069:e82c1fc1df38
(mac_coerce_file_name_ptr, mac_coerce_file_name_desc)
(create_apple_event_from_event_ref, xrm_get_preference_database)
(cfstring_create_normalized): Don't check return value of xmalloc.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Tue, 18 Apr 2006 08:11:56 +0000 |
parents | 2c4ba2c48153 |
children | 9559d7f62131 |
files | src/mac.c |
diffstat | 1 files changed, 24 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mac.c Tue Apr 18 08:10:30 2006 +0000 +++ b/src/mac.c Tue Apr 18 08:11:56 2006 +0000 @@ -453,15 +453,10 @@ char *buf; buf = xmalloc (data_size + 1); - if (buf) - { - memcpy (buf, data_ptr, data_size); - buf[data_size] = '\0'; - err = posix_pathname_to_fsspec (buf, &fs); - xfree (buf); - } - else - err = memFullErr; + memcpy (buf, data_ptr, data_size); + buf[data_size] = '\0'; + err = posix_pathname_to_fsspec (buf, &fs); + xfree (buf); if (err == noErr) err = AECoercePtr (typeFSS, &fs, sizeof (FSSpec), to_type, result); #endif @@ -489,14 +484,11 @@ { size = AEGetDescDataSize (&desc); buf = xmalloc (size); - if (buf) - { - err = AEGetDescData (&desc, buf, size); - if (err == noErr) - url = CFURLCreateWithBytes (NULL, buf, size, - kCFStringEncodingUTF8, NULL); - xfree (buf); - } + err = AEGetDescData (&desc, buf, size); + if (err == noErr) + url = CFURLCreateWithBytes (NULL, buf, size, + kCFStringEncodingUTF8, NULL); + xfree (buf); AEDisposeDesc (&desc); } } @@ -581,21 +573,16 @@ data_size = GetHandleSize (from_desc->dataHandle); #endif data_ptr = xmalloc (data_size); - if (data_ptr) - { #if TARGET_API_MAC_CARBON - err = AEGetDescData (from_desc, data_ptr, data_size); + err = AEGetDescData (from_desc, data_ptr, data_size); #else - memcpy (data_ptr, *(from_desc->dataHandle), data_size); + memcpy (data_ptr, *(from_desc->dataHandle), data_size); #endif - if (err == noErr) - err = mac_coerce_file_name_ptr (from_type, data_ptr, - data_size, to_type, - handler_refcon, result); - xfree (data_ptr); - } - else - err = memFullErr; + if (err == noErr) + err = mac_coerce_file_name_ptr (from_type, data_ptr, + data_size, to_type, + handler_refcon, result); + xfree (data_ptr); } if (err != noErr) @@ -691,8 +678,6 @@ if (err != noErr) break; buf = xmalloc (size); - if (buf == NULL) - break; err = GetEventParameter (event, names[i], types[i], NULL, size, NULL, buf); if (err == noErr) @@ -1596,8 +1581,6 @@ count = CFSetGetCount (key_set); keys = xmalloc (sizeof (CFStringRef) * count); - if (keys == NULL) - goto out; CFSetGetValues (key_set, (const void **)keys); for (index = 0; index < count; index++) { @@ -4547,11 +4530,8 @@ if (in_text == NULL) { buffer = xmalloc (sizeof (UniChar) * length); - if (buffer) - { - CFStringGetCharacters (str, CFRangeMake (0, length), buffer); - in_text = buffer; - } + CFStringGetCharacters (str, CFRangeMake (0, length), buffer); + in_text = buffer; } if (in_text) @@ -4559,15 +4539,12 @@ while (err == noErr) { out_buf = xmalloc (out_size); - if (out_buf == NULL) - err = mFulErr; - else - err = ConvertFromUnicodeToText (uni, length * sizeof (UniChar), - in_text, - kUnicodeDefaultDirectionMask, - 0, NULL, NULL, NULL, - out_size, &out_read, &out_len, - out_buf); + err = ConvertFromUnicodeToText (uni, length * sizeof (UniChar), + in_text, + kUnicodeDefaultDirectionMask, + 0, NULL, NULL, NULL, + out_size, &out_read, &out_len, + out_buf); if (err == noErr && out_read < length * sizeof (UniChar)) { xfree (out_buf);