emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: request for review: Doing direct file I/O in Emacs Lisp


From: Andreas Schwab
Subject: Re: request for review: Doing direct file I/O in Emacs Lisp
Date: Mon, 10 May 2004 11:38:09 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

John Wiegley <address@hidden> 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 = fopen(SDATA (path), SDATA (mode));
> +  if (! stream)
> +    return Qnil;

You should signal an error instead of just returning nil.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]