Dmitry Antipov | 15 Aug 2012 16:02
Picon
Favicon

Minor nsfont.m fix

Since we do not expect NULL from xmalloc and xzalloc, some redundant checks
may be omitted, OK?

Dmitry
=== modified file 'src/nsfont.m'
--- src/nsfont.m	2012-07-13 18:03:10 +0000
+++ src/nsfont.m	2012-08-15 13:48:52 +0000
 <at>  <at>  -1292,8 +1292,6  <at>  <at> 
 #endif

   font_info->glyphs[block] = xmalloc (0x100 * sizeof (unsigned short));
-  if (!unichars || !(font_info->glyphs[block]))
-    abort ();

   /* create a string containing all Unicode characters in this block */
   for (idx = block<<8, i = 0; i < 0x100; idx++, i++)
 <at>  <at>  -1367,8 +1365,6  <at>  <at> 
  sfont = [font_info->nsfont screenFont];

   font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics));
-  if (!(font_info->metrics[block]))
-    abort ();

   metrics = font_info->metrics[block];
   for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++)

Paul Eggert | 17 Aug 2012 06:37
Favicon

Re: Minor nsfont.m fix

On 08/15/2012 07:02 AM, Dmitry Antipov wrote:
> Since we do not expect NULL from xmalloc and xzalloc, some redundant checks
> may be omitted, OK?

Yes, thanks, that makes sense.

In this particular case, can't we go one better by replacing this:

  unichar *unichars = xmalloc (0x101 * sizeof (unichar));
  ...
  xfree (unichars);

with this?

  unichar unichars[0x101];
  ...


Gmane