unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Minor nsfont.m fix
@ 2012-08-15 14:02 Dmitry Antipov
  2012-08-17  4:37 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2012-08-15 14:02 UTC (permalink / raw)
  To: Jan Djärv, Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

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

Dmitry

[-- Attachment #2: nsfont.patch --]
[-- Type: text/plain, Size: 732 bytes --]

=== 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
@@ -1292,8 +1292,6 @@
 #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++)
@@ -1367,8 +1365,6 @@
  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++)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Minor nsfont.m fix
  2012-08-15 14:02 Minor nsfont.m fix Dmitry Antipov
@ 2012-08-17  4:37 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2012-08-17  4:37 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Jan Djärv, Emacs development discussions

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];
  ...




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-17  4:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-15 14:02 Minor nsfont.m fix Dmitry Antipov
2012-08-17  4:37 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).