unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <jmbarranquero@wke.es>
Cc: Andreas Schwab <schwab@suse.de>, emacs-devel@gnu.org
Subject: Re: [PATCH] Delayed loading of image libraries
Date: Fri, 02 Jul 2004 10:45:03 +0200	[thread overview]
Message-ID: <20040702103748.CF3D.JMBARRANQUERO@wke.es> (raw)
In-Reply-To: <buohdsqakhu.fsf@mctpc71.ucom.lsi.nec.co.jp>


On Fri, 02 Jul 2004 17:20:13 +0900
Miles Bader <miles@lsi.nec.co.jp> wrote:

> That seems obvious -- just don't display it.



> If lookup_image_type returns null, at least valid_image_p should return
> 0 (after my change), and many places use that as a guard.  Perhaps there
> are more places checks should be inserted -- but inserting such checks
> seems like the right thing to do.

There are many places where valid_image_p is checked, like this one:

static struct image *
make_image (spec, hash)
     Lisp_Object spec;
     unsigned hash;
{
  struct image *img = (struct image *) xmalloc (sizeof *img);

  xassert (valid_image_p (spec));
  bzero (img, sizeof *img);
  img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
  xassert (img->type != NULL);
  img->spec = spec;
  img->data.lisp_val = Qnil;
  img->ascent = DEFAULT_IMAGE_ASCENT;
  img->hash = hash;
  return img;
}

Now, xassert is (in src/dispextern.h):

#if GLYPH_DEBUG
#define IF_DEBUG(X)	X
#define xassert(X)	do {if (!(X)) abort ();} while (0)
#else
#define IF_DEBUG(X)	(void) 0
#define xassert(X)	(void) 0
#endif

I don't think GLYPH_DEBUG is always defined, so xassert will do nothing. 
But even if it did, asserting out of a function because you have a Lisp
value that cannot be *displayed* doesn't seem right.  The decision rests
at a higher level about what to do with the value.  A PNG on a non-PNG
Emacs shouldn't be non-valid; what it is, is not-available.

                                                                Juanma

  reply	other threads:[~2004-07-02  8:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-10 12:38 [PATCH] Delayed loading of image libraries Juanma Barranquero
2004-06-30 10:15 ` Andreas Schwab
2004-06-30 11:13   ` Juanma Barranquero
2004-06-30 11:24     ` Andreas Schwab
2004-06-30 11:34       ` Juanma Barranquero
2004-06-30 11:41         ` Andreas Schwab
2004-06-30 13:00           ` Juanma Barranquero
2004-06-30 15:42         ` Miles Bader
2004-07-01  9:30           ` Juanma Barranquero
2004-07-01  9:48             ` Miles Bader
2004-07-01 10:13               ` Juanma Barranquero
2004-07-02  1:16                 ` Miles Bader
2004-07-02  7:02                   ` Juanma Barranquero
2004-07-02  7:10                     ` David Kastrup
2004-07-02  7:41                       ` Juanma Barranquero
2004-07-02  7:56                         ` Miles Bader
2004-07-02  8:10                           ` Juanma Barranquero
2004-07-02  8:20                             ` Miles Bader
2004-07-02  8:45                               ` Juanma Barranquero [this message]
2004-07-02  8:59                                 ` Miles Bader
2004-07-02  9:02                                   ` Miles Bader
2004-07-02  8:11                         ` David Kastrup
2004-07-02  8:34                           ` Juanma Barranquero
2004-07-03 18:21                     ` Richard Stallman
2004-06-30 14:19       ` Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040702103748.CF3D.JMBARRANQUERO@wke.es \
    --to=jmbarranquero@wke.es \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).