Commit b96fe6ea authored by YAMAMOTO Mitsuharu's avatar YAMAMOTO Mitsuharu
Browse files

(XCreateGC, x_per_char_metric, xlfdpat_create)

(init_font_name_table, init_font_name_table, mac_do_list_fonts)
(XLoadQueryFont, mac_store_apple_event): Don't check
return value of xmalloc.
parent 1091c0b3
2006-04-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* image.c (x_create_bitmap_from_data) [MAC_OS]: Don't check return
value of xmalloc.
* mac.c (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.
* macselect.c (get_scrap_target_type_list, defer_apple_events)
(copy_scrap_flavor_data, mac_handle_service_event): Don't check
return value of xmalloc/xrealloc.
* macterm.c (XCreateGC, x_per_char_metric, xlfdpat_create)
(init_font_name_table, init_font_name_table, mac_do_list_fonts)
(XLoadQueryFont, mac_store_apple_event): Don't check
return value of xmalloc.
2006-04-17 Kim F. Storm <storm@cua.dk>
 
* window.c (coordinates_in_window): On the vertical border,
......
......@@ -1508,11 +1508,8 @@ XCreateGC (display, window, mask, xgcv)
{
GC gc = xmalloc (sizeof (*gc));
if (gc)
{
bzero (gc, sizeof (*gc));
XChangeGC (display, gc, mask, xgcv);
}
bzero (gc, sizeof (*gc));
XChangeGC (display, gc, mask, xgcv);
return gc;
}
......@@ -2160,21 +2157,17 @@ x_per_char_metric (font, char2b)
if (*row == NULL)
{
*row = xmalloc (sizeof (XCharStructRow));
if (*row)
bzero (*row, sizeof (XCharStructRow));
bzero (*row, sizeof (XCharStructRow));
}
if (*row)
pcm = (*row)->per_char + char2b->byte2;
if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
{
pcm = (*row)->per_char + char2b->byte2;
if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
{
BLOCK_INPUT;
mac_query_char_extents (font->mac_style,
(char2b->byte1 << 8) + char2b->byte2,
NULL, NULL, pcm, NULL);
UNBLOCK_INPUT;
XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
}
BLOCK_INPUT;
mac_query_char_extents (font->mac_style,
(char2b->byte1 << 8) + char2b->byte2,
NULL, NULL, pcm, NULL);
UNBLOCK_INPUT;
XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
}
}
else
......@@ -6563,12 +6556,7 @@ xlfdpat_create (pattern)
struct xlfdpat_block *blk;
pat = xmalloc (sizeof (struct xlfdpat));
if (pat == NULL)
goto error;
pat->buf = xmalloc (strlen (pattern) + 1);
if (pat->buf == NULL)
goto error;
/* Normalize the pattern string and store it to `pat->buf'. */
nblocks = 0;
......@@ -6632,8 +6620,6 @@ xlfdpat_create (pattern)
}
pat->blocks = xmalloc (sizeof (struct xlfdpat_block) * nblocks);
if (pat->blocks == NULL)
goto error;
/* Divide the normalized pattern into blocks. */
p = pat->buf;
......@@ -7093,9 +7079,10 @@ init_font_name_table ()
Qnil, Qnil, Qnil);;
err = ATSUFontCount (&nfonts);
if (err == noErr)
font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
if (font_ids)
err = ATSUGetFontIDs (font_ids, nfonts, NULL);
{
font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
err = ATSUGetFontIDs (font_ids, nfonts, NULL);
}
if (err == noErr)
for (i = 0; i < nfonts; i++)
{
......@@ -7105,8 +7092,6 @@ init_font_name_table ()
if (err != noErr)
continue;
name = xmalloc (name_len + 1);
if (name == NULL)
continue;
name[name_len] = '\0';
err = ATSUFindFontName (font_ids[i], kFontFamilyName,
kFontMacintoshPlatform, kFontNoScript,
......@@ -7436,8 +7421,6 @@ mac_do_list_fonts (pattern, maxnames)
int former_len = ptr - font_name_table[i];
scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1);
if (scaled == NULL)
continue;
memcpy (scaled, font_name_table[i], former_len);
sprintf (scaled + former_len,
"-%d-%d-72-72-m-%d-%s",
......@@ -7770,18 +7753,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
font->max_char_or_byte2 = 0xff;
font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100);
if (font->bounds.rows == NULL)
{
mac_unload_font (&one_mac_display_info, font);
return NULL;
}
bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100);
font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow));
if (font->bounds.rows[0] == NULL)
{
mac_unload_font (&one_mac_display_info, font);
return NULL;
}
bzero (font->bounds.rows[0], sizeof (XCharStructRow));
#if USE_CG_TEXT_DRAWING
......@@ -7803,9 +7776,10 @@ XLoadQueryFont (Display *dpy, char *fontname)
}
if (font->cg_font)
font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
if (font->cg_glyphs)
bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
{
font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
}
#endif
space_bounds = font->bounds.rows[0]->per_char + 0x20;
err = mac_query_char_extents (font->mac_style, 0x20,
......@@ -7951,11 +7925,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
font->bounds.per_char =
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
if (font->bounds.per_char == NULL)
{
mac_unload_font (&one_mac_display_info, font);
return NULL;
}
bzero (font->bounds.per_char,
sizeof (XCharStruct) * (0xff - 0x20 + 1));
......@@ -8958,15 +8927,12 @@ mac_store_apple_event (class, id, desc)
Lisp_Object class, id;
const AEDesc *desc;
{
OSErr err = noErr;
OSErr err;
struct input_event buf;
AEDesc *desc_copy;
desc_copy = xmalloc (sizeof (AEDesc));
if (desc_copy == NULL)
err = memFullErr;
else
err = AEDuplicateDesc (desc, desc_copy);
err = AEDuplicateDesc (desc, desc_copy);
if (err == noErr)
{
EVENT_INIT (buf);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment