From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: request for review: Doing direct file I/O in Emacs Lisp Date: Mon, 10 May 2004 11:38:09 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1084183106 24516 80.91.224.253 (10 May 2004 09:58:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 10 May 2004 09:58:26 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 10 11:58:18 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BN7YA-0004aa-00 for ; Mon, 10 May 2004 11:58:18 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BN7YA-0004Sx-00 for ; Mon, 10 May 2004 11:58:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.33) id 1BN7WY-0004Xz-Uy for emacs-devel@quimby.gnus.org; Mon, 10 May 2004 05:56:38 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.33) id 1BN7Ui-0003j5-QQ for emacs-devel@gnu.org; Mon, 10 May 2004 05:54:44 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.33) id 1BN7Gs-0000mp-Rv for emacs-devel@gnu.org; Mon, 10 May 2004 05:41:00 -0400 Original-Received: from [195.135.220.2] (helo=Cantor.suse.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.33) id 1BN7Eh-0000WZ-LO; Mon, 10 May 2004 05:38:11 -0400 Original-Received: from hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 4E12C581E76; Mon, 10 May 2004 11:38:10 +0200 (CEST) Original-To: John Wiegley X-Yow: PUNK ROCK!! DISCO DUCK!! BIRTH CONTROL!! In-Reply-To: (John Wiegley's message of "Sun, 09 May 2004 22:59:11 -0700") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23030 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23030 John Wiegley writes: > +DEFUN ("file-handle-open", Ffile_handle_open, Sfile_handle_open, > + 2, 2, 0, > + doc: /* Open a file handle for direct reading/writing. */) > + (path, mode) > + Lisp_Object path, mode; > +{ > + FILE *stream; > + Lisp_Object handle, lispstream; > + struct Lisp_File_Handle *lh; > + > + if (! STRINGP (path) || ! STRINGP (mode)) > + return Qnil; > + > + if (! Ffile_exists_p (path)) > + return Qnil; > + > + stream =3D fopen(SDATA (path), SDATA (mode)); > + if (! stream) > + return Qnil; You should signal an error instead of just returning nil. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."