From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: using libmagic in Emacs? Date: Sat, 22 Aug 2009 00:46:59 +0200 Message-ID: References: <83k50xh1m8.fsf@gnu.org> <837hwxgg9w.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250894875 2365 80.91.229.12 (21 Aug 2009 22:47:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Aug 2009 22:47:55 +0000 (UTC) Cc: Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 22 00:47:48 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mecte-0005zC-2X for ged-emacs-devel@m.gmane.org; Sat, 22 Aug 2009 00:47:46 +0200 Original-Received: from localhost ([127.0.0.1]:48155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mectd-000100-KY for ged-emacs-devel@m.gmane.org; Fri, 21 Aug 2009 18:47:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mect9-0000mG-UA for emacs-devel@gnu.org; Fri, 21 Aug 2009 18:47:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mect5-0000jo-4W for emacs-devel@gnu.org; Fri, 21 Aug 2009 18:47:15 -0400 Original-Received: from [199.232.76.173] (port=56915 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mect4-0000jd-VM for emacs-devel@gnu.org; Fri, 21 Aug 2009 18:47:11 -0400 Original-Received: from mail-out.m-online.net ([212.18.0.10]:49719) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mect0-0007x9-Ky; Fri, 21 Aug 2009 18:47:07 -0400 Original-Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id EC9AC1C00245; Sat, 22 Aug 2009 00:47:02 +0200 (CEST) Original-Received: from localhost (dynscan2.mnet-online.de [192.168.1.215]) by mail.m-online.net (Postfix) with ESMTP id A0C6890664; Sat, 22 Aug 2009 00:47:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Original-Received: from mail.mnet-online.de ([192.168.3.149]) by localhost (dynscan2.mnet-online.de [192.168.1.215]) (amavisd-new, port 10024) with ESMTP id s+e4LKevKjp8; Sat, 22 Aug 2009 00:47:01 +0200 (CEST) Original-Received: from igel.home (DSL01.83.171.166.81.ip-pool.NEFkom.net [83.171.166.81]) by mail.mnet-online.de (Postfix) with ESMTP; Sat, 22 Aug 2009 00:47:01 +0200 (CEST) Original-Received: by igel.home (Postfix, from userid 501) id 743AE10DBBE; Sat, 22 Aug 2009 00:46:59 +0200 (CEST) X-Yow: Yow! I want my nose in lights! In-Reply-To: (joakim@verona.se's message of "Fri, 21 Aug 2009 23:48:30 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114499 Archived-At: joakim@verona.se writes: > + GCPRO6 (file_description, file_mime, file_encoding, rv, absname, encoded_absname); That's too much. You only need to protect variables used around calls that can GC. Arguments to lisp functions are implicitly protected. For example, there are no function calls during the lifetime of absname. And encoded_absname is completely unused. > + libmagic_error: > + report_file_error("Libmagic error",Qnil); > + if (cookie != NULL) magic_close (cookie); report_file_error throws, so you leak a resource. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."