From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Lisp object that refers to a C struct Date: Thu, 18 Oct 2012 13:17:50 +0200 Message-ID: <83wqyo1129.fsf@gnu.org> References: <83ehkz4edw.fsf@gnu.org> <83bog33wdr.fsf@gnu.org> <837gqq49j7.fsf@gnu.org> <83r4ox3frd.fsf@gnu.org> <83ipa92i95.fsf@gnu.org> <83bog03jyf.fsf@gnu.org> <507F2C74.4070107@cs.ucla.edu> <83391c2xjq.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1350559086 19859 80.91.229.3 (18 Oct 2012 11:18:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2012 11:18:06 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 18 13:18:11 2012 Return-path: Envelope-to: ged-emacs-devel@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 1TOo75-0007JB-FO for ged-emacs-devel@m.gmane.org; Thu, 18 Oct 2012 13:18:07 +0200 Original-Received: from localhost ([::1]:36354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOo6x-00056c-NG for ged-emacs-devel@m.gmane.org; Thu, 18 Oct 2012 07:17:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOo6v-00056X-9r for emacs-devel@gnu.org; Thu, 18 Oct 2012 07:17:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOo6q-0001dC-BF for emacs-devel@gnu.org; Thu, 18 Oct 2012 07:17:57 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:65222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOo6q-0001ah-35 for emacs-devel@gnu.org; Thu, 18 Oct 2012 07:17:52 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MC300M00614XU00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Thu, 18 Oct 2012 13:17:33 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MC300KJ5619ROU0@a-mtaout22.012.net.il>; Thu, 18 Oct 2012 13:17:33 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154409 Archived-At: > From: Juanma Barranquero > Date: Thu, 18 Oct 2012 10:52:21 +0200 > Cc: Paul Eggert , emacs-devel@gnu.org > > On Thu, Oct 18, 2012 at 6:50 AM, Eli Zaretskii wrote: > > > No, because, like Stephen says, the descriptor is first validated > > against a list of known ones. > > In that case, wouldn't it be better to have the integer be an index > into a table, like Stefan suggested? It's easy to do that (of course, at a price of some slightly more complicated memory management), but I think Stefan still prefers the "new object" solution. > It's faster to check that it is in range than compare it with an > arbitrarily long list of known pointers. That's not what the code does. It calls Fassoc_quit to find the descriptor in the list of known live watches (which will still be needed under the table suggestion), and then validates the pointer itself, just in case (which is also independent of the table suggestion).