changeset 15222:cc264dd966cd

(Fmsdos_downcase_filename): Don't change the argument, return a copy.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 May 1996 17:45:36 +0000
parents f64513177b11
children be1bc5b3f14e
files src/msdos.c
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Sun May 12 17:43:29 1996 +0000
+++ b/src/msdos.c	Sun May 12 17:45:36 1996 +0000
@@ -2246,14 +2246,21 @@
 DEFUN ("msdos-downcase-filename", Fmsdos_downcase_filename, Smsdos_downcase_filename,
        1, 1, 0,
   "Convert alphabetic characters in FILENAME to lower case and return that.\n\
-When long filenames are supported, doesn't change FILENAME.")
+When long filenames are supported, doesn't change FILENAME.\n\
+If FILENAME is not a string, returns nil.\n\
+The argument object is never altered--the value is a copy.")
   (filename)
      Lisp_Object filename;
 {
-  char *fname = XSTRING (filename)->data;
-
-  msdos_downcase_filename (fname);
-  return make_string (fname, XSTRING (filename)->size);
+  char *fname;
+  Lisp_Object tem;
+
+  if (! STRINGP (filename))
+    return Qnil;
+
+  tem = Fcopy_sequence (filename);
+  msdos_downcase_filename (XSTRING (tem)->data);
+  return tem;
 }
 
 /* The Emacs root directory as determined by init_environment.  */