changeset 26735:c13ab7bc6fdc

(Fintern_soft): Accept a symbol argument.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 06 Dec 1999 17:52:27 +0000
parents 47e94e83148f
children a0674327c167
files src/lread.c
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/lread.c	Mon Dec 06 17:44:17 1999 +0000
+++ b/src/lread.c	Mon Dec 06 17:52:27 1999 +0000
@@ -2752,25 +2752,33 @@
 }
 
 DEFUN ("intern-soft", Fintern_soft, Sintern_soft, 1, 2, 0,
-  "Return the canonical symbol whose name is STRING, or nil if none exists.\n\
+  "Return the canonical symbol named NAME, or nil if none exists.\n\
+NAME may be a string or a symbol.  If it is a symbol, that exact
+symbol is searched for.
 A second optional argument specifies the obarray to use;\n\
 it defaults to the value of `obarray'.")
-  (string, obarray)
-     Lisp_Object string, obarray;
+  (name, obarray)
+     Lisp_Object name, obarray;
 {
   register Lisp_Object tem;
+  struct Lisp_String *string;
 
   if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
 
-  CHECK_STRING (string, 0);
-
-  tem = oblookup (obarray, XSTRING (string)->data,
-		  XSTRING (string)->size,
-		  STRING_BYTES (XSTRING (string)));
-  if (!INTEGERP (tem))
+  if (!SYMBOLP (name))
+    {
+      CHECK_STRING (name, 0);
+      string = XSTRING (name);
+    }
+  else
+    string = XSYMBOL (name)->name;
+
+  tem = oblookup (obarray, string->data, string->size, STRING_BYTES (string));
+  if (INTEGERP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
+    return Qnil;
+  else
     return tem;
-  return Qnil;
 }
 
 DEFUN ("unintern", Funintern, Sunintern, 1, 2, 0,