From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#12463: 24.2; pos-visible-in-window-p gets slower over time Date: Fri, 21 Sep 2012 20:03:34 +0300 Message-ID: <838vc3xq8p.fsf@gnu.org> References: <87wqzs1a4c.fsf@queen.i-did-not-set--mail-host-address--so-tickle-me> <83mx0n22p0.fsf@gnu.org> <87d31jcqce.fsf@gnu.org> <4023344.MyoQPQRfcJ@queen> <87sjac1185.fsf@gnu.org> <878vc4ylr6.fsf@gnu.org> <87r4pvitjk.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1348247017 4797 80.91.229.3 (21 Sep 2012 17:03:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Sep 2012 17:03:37 +0000 (UTC) Cc: lekktu@gmail.com, jwalt@garni.ch, 12463@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 21 19:03:40 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TF6dd-0008HG-TZ for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Sep 2012 19:03:38 +0200 Original-Received: from localhost ([::1]:55531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF6dZ-00073V-Ek for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Sep 2012 13:03:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF6dR-00071C-Sk for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2012 13:03:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF6dQ-0007RQ-Q1 for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2012 13:03:25 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF6dQ-0007RM-M4 for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2012 13:03:24 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TF6f0-0006cW-8b for bug-gnu-emacs@gnu.org; Fri, 21 Sep 2012 13:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Sep 2012 17:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12463-submit@debbugs.gnu.org id=B12463.134824709925440 (code B ref 12463); Fri, 21 Sep 2012 17:05:02 +0000 Original-Received: (at 12463) by debbugs.gnu.org; 21 Sep 2012 17:04:59 +0000 Original-Received: from localhost ([127.0.0.1]:47334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TF6ex-0006cG-2v for submit@debbugs.gnu.org; Fri, 21 Sep 2012 13:04:59 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:59437) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TF6ev-0006c9-2h for 12463@debbugs.gnu.org; Fri, 21 Sep 2012 13:04:58 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MAP00C00LLTM400@a-mtaout23.012.net.il> for 12463@debbugs.gnu.org; Fri, 21 Sep 2012 20:03:18 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MAP00CX8M1HC2B0@a-mtaout23.012.net.il>; Fri, 21 Sep 2012 20:03:18 +0300 (IDT) In-reply-to: <87r4pvitjk.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:64695 Archived-At: > From: Chong Yidong > Date: Fri, 21 Sep 2012 18:01:19 +0800 > Cc: J=F6rg Walter , 12463@debbugs.gnu.org >=20 > Thanks. Fixed in the attached patch, which also addresses Eli's ot= her > comments. Please take a look again. Thanks. > /* Define a new image type from TYPE. This adds a copy of TYPE t= o > ! image_types and caches the loading status of TYPE. > =20 > ! LIBRARIES is an alist associating dynamic libraries to externa= l > ! files implementing them, which is passed to the image library > ! initialization function if necessary. A nil value defaults to > ! Vdynamic_library_alist. */ > !=20 > ! static struct image_type * > ! define_image_type (struct image_type *type, Lisp_Object libraries= ) > { > ! struct image_type *p =3D NULL; > ! Lisp_Object target_type =3D *type->type; > ! int type_valid =3D 1; > =20 > ! for (p =3D image_types; p; p =3D p->next) > ! if (EQ (*p->type, target_type)) > ! return p; > !=20 > ! if (type->init) > { > ! #ifdef HAVE_NTGUI > ! /* If we failed to load the library before, don't try again= . */ > ! Lisp_Object tested =3D Fassq (target_type, Vlibrary_cache); > ! if (CONSP (tested) && NILP (XCDR (tested))) > ! =09type_valid =3D 0; > ! else > ! #endif > ! =09{ > ! =09 /* If the load failed, avoid trying again. */ > ! =09 type_valid =3D (*type->init)(libraries); > ! =09 CACHE_IMAGE_TYPE (target_type, type_valid); > ! =09} > ! } > =20 > + if (type_valid) > + { > /* Make a copy of TYPE to avoid a bus error in a dumped Ema= cs. > The initialized data segment is read-only. */ > p =3D xmalloc (sizeof *p); > *p =3D *type; > p->next =3D image_types; > image_types =3D p; > } > =20 > ! return p; > } Am I missing something, or will this really call the initialization function again and again and again? AFAIU, if an image's library is already in Vlibrary_cache, and the cdr of its association is non-nil, that means the initialization function was already called for the corresponding image type, and it returned non-zero. So there's no need to call it again.