aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBT Templeton <[email protected]>2013-09-22 16:31:27 -0400
committerRobin Templeton <[email protected]>2015-04-19 03:43:03 -0400
commit3250348fd32d80f2856b92890c75b42492a69893 (patch)
tree4b4b4c53f3447d90e193f2b7ffdca1533d371c10 /src
parent844e0de1bc2bf56118b749f50a4880db7c918fd5 (diff)
* src/lread.c (oblookup): Remove. All callers changed.
Diffstat (limited to 'src')
-rw-r--r--src/doc.c12
-rw-r--r--src/font.c7
-rw-r--r--src/lisp.h1
-rw-r--r--src/lread.c120
-rw-r--r--src/w32font.c6
5 files changed, 44 insertions, 102 deletions
diff --git a/src/doc.c b/src/doc.c
index a0d01c2b73..2fa2baffda 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -647,15 +647,17 @@ the same file name is found in the `doc-directory'. */)
}
}
- sym = oblookup (Vobarray, p + 2,
- multibyte_chars_in_text ((unsigned char *) p + 2,
- end - p - 2),
- end - p - 2);
+ Lisp_Object tem = Ffind_symbol (make_specified_string (p + 2,
+ -1,
+ end - p - 2,
+ true),
+ Qnil);
+ sym = scm_c_value_ref (tem, 0);
/* Check skip_file so that when a function is defined several
times in different files (typically, once in xterm, once in
w32term, ...), we only pay attention to the one that
matters. */
- if (! skip_file && SYMBOLP (sym))
+ if (! skip_file && ! NILP (scm_c_value_ref (tem, 1)))
{
/* Attach a docstring to a variable? */
if (p[1] == 'V')
diff --git a/src/font.c b/src/font.c
index ddf28562c7..bb9629c7bd 100644
--- a/src/font.c
+++ b/src/font.c
@@ -277,13 +277,8 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
/* This code is similar to intern function from lread.c. */
obarray = check_obarray (Vobarray);
parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
- tem = oblookup (obarray, str,
- (len == nchars || len != nbytes) ? len : nchars, len);
-
- if (SYMBOLP (tem))
- return tem;
tem = make_specified_string (str, nchars, len,
- len != nchars && len == nbytes);
+ len != nchars && len == nbytes);
return Fintern (tem, obarray);
}
diff --git a/src/lisp.h b/src/lisp.h
index 39dc624bce..cd120c7889 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3312,7 +3312,6 @@ extern Lisp_Object check_obarray (Lisp_Object);
extern Lisp_Object intern_1 (const char *, ptrdiff_t);
extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
extern Lisp_Object obhash (Lisp_Object);
-extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
INLINE void
LOADHIST_ATTACH (Lisp_Object x)
{
diff --git a/src/lread.c b/src/lread.c
index 9ce2bcb7a2..39b49ab9f1 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3786,30 +3786,39 @@ check_obarray (Lisp_Object obarray)
Lisp_Object
intern_1 (const char *str, ptrdiff_t len)
{
- Lisp_Object obarray = check_obarray (Vobarray);
- Lisp_Object tem = oblookup (obarray, str, len, len);
-
- return SYMBOLP (tem) ? tem : Fintern (make_string (str, len), obarray);
+ return Fintern (make_string (str, len), Qnil);
}
Lisp_Object
intern_c_string_1 (const char *str, ptrdiff_t len)
{
- Lisp_Object obarray = check_obarray (Vobarray);
- Lisp_Object tem = oblookup (obarray, str, len, len);
-
- if (SYMBOLP (tem))
- return tem;
+ return Fintern (make_pure_c_string (str, len), Qnil);
+}
+
+DEFUN ("find-symbol", Ffind_symbol, Sfind_symbol, 1, 2, 0,
+ doc: /* find-symbol */)
+ (Lisp_Object string, Lisp_Object obarray)
+{
+ Lisp_Object tem, sstring, found;
- if (NILP (Vpurify_flag))
- /* Creating a non-pure string from a string literal not
- implemented yet. We could just use make_string here and live
- with the extra copy. */
- emacs_abort ();
+ obarray = check_obarray (NILP (obarray) ? Vobarray : obarray);
+ CHECK_STRING (string);
- return Fintern (make_pure_c_string (str, len), obarray);
+ sstring = scm_from_utf8_stringn (SSDATA (string), SBYTES (string));
+ tem = scm_find_symbol (sstring, obhash (obarray));
+ if (scm_is_true (tem)
+ && scm_is_true (scm_module_variable (symbol_module, tem)))
+ {
+ if (EQ (tem, Qnil_))
+ tem = Qnil;
+ else if (EQ (tem, Qt_))
+ tem = Qt;
+ return scm_values (scm_list_2 (tem, Qt));
+ }
+ else
+ return scm_values (scm_list_2 (Qnil, Qnil));
}
-
+
DEFUN ("intern", Fintern, Sintern, 1, 2, 0,
doc: /* Return the canonical symbol whose name is STRING.
If there is none, one is created by this function and returned.
@@ -3824,14 +3833,9 @@ it defaults to the value of `obarray'. */)
CHECK_STRING (string);
- tem = oblookup (obarray, SSDATA (string),
- SCHARS (string),
- SBYTES (string));
- if (SYMBOLP (tem))
- return tem;
-
- if (!NILP (Vpurify_flag))
- string = Fpurecopy (string);
+ tem = Ffind_symbol (string, obarray);
+ if (! NILP (scm_c_value_ref (tem, 1)))
+ return scm_c_value_ref (tem, 0);
sym = scm_intern (scm_from_utf8_stringn (SSDATA (string),
SBYTES (string)),
@@ -3846,9 +3850,7 @@ it defaults to the value of `obarray'. */)
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
}
- return scm_intern (scm_from_utf8_stringn (SSDATA (string),
- SBYTES (string)),
- obhash (obarray));
+ return sym;
}
DEFUN ("intern-soft", Fintern_soft, Sintern_soft, 1, 2, 0,
@@ -3859,41 +3861,18 @@ A second optional argument specifies the obarray to use;
it defaults to the value of `obarray'. */)
(Lisp_Object name, Lisp_Object obarray)
{
- register Lisp_Object tem, string;
-
- if (NILP (obarray)) obarray = Vobarray;
- obarray = check_obarray (obarray);
+ register Lisp_Object tem, string, mv, found;
- if (!SYMBOLP (name))
- {
- CHECK_STRING (name);
- string = name;
- }
- else
- string = SYMBOL_NAME (name);
+ string = SYMBOLP (name) ? SYMBOL_NAME (name) : name;
+ mv = Ffind_symbol (string, obarray);
+ tem = scm_c_value_ref (mv, 0);
+ found = scm_c_value_ref (mv, 1);
- tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string));
- if (INTEGERP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
+ if (NILP (found) || (SYMBOLP (name) && !EQ (name, tem)))
return Qnil;
else
return tem;
}
-
-DEFUN ("find-symbol", Ffind_symbol, Sfind_symbol, 1, 2, 0,
- doc: /* find-symbol */)
- (Lisp_Object string, Lisp_Object obarray)
-{
- Lisp_Object tem;
-
- obarray = check_obarray (NILP (obarray) ? Vobarray : obarray);
- CHECK_STRING (string);
-
- tem = oblookup (obarray, SSDATA (string), SCHARS (string), SBYTES (string));
- if (INTEGERP (tem))
- return scm_values (scm_list_2 (Qnil, Qnil));
- else
- return scm_values (scm_list_2 (tem, Qt));
-}
DEFUN ("unintern", Funintern, Sunintern, 1, 2, 0,
doc: /* Delete the symbol named NAME, if any, from OBARRAY.
@@ -3929,35 +3908,6 @@ usage: (unintern NAME OBARRAY) */)
return (scm_is_true (scm_unintern (name, obhash (obarray))) ? Qt : Qnil);
}
-/* Return the symbol in OBARRAY whose names matches the string
- of SIZE characters (SIZE_BYTE bytes) at PTR.
- If there is no such symbol, return the integer bucket number of
- where the symbol would be if it were present.
-
- Also store the bucket number in oblookup_last_bucket_number. */
-
-Lisp_Object
-oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff_t size_byte)
-{
- Lisp_Object sym;
- Lisp_Object string2 = scm_from_utf8_stringn (ptr, size_byte);
-
- obarray = check_obarray (obarray);
- sym = scm_find_symbol (string2, obhash (obarray));
- if (scm_is_true (sym)
- && scm_is_true (scm_module_variable (symbol_module, sym)))
- {
- if (EQ (sym, Qnil_))
- return Qnil;
- else if (EQ (sym, Qt_))
- return Qt;
- else
- return sym;
- }
- else
- return make_number (0);
-}
-
void
map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg)
{
diff --git a/src/w32font.c b/src/w32font.c
index 66d6fe2d05..b543dfe298 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -287,11 +287,7 @@ Lisp_Object
intern_font_name (char * string)
{
Lisp_Object str = DECODE_SYSTEM (build_string (string));
- int len = SCHARS (str);
- Lisp_Object obarray = check_obarray (Vobarray);
- Lisp_Object tem = oblookup (obarray, SDATA (str), len, len);
- /* This code is similar to intern function from lread.c. */
- return SYMBOLP (tem) ? tem : Fintern (str, obarray);
+ return Fintern (str, obarray);
}
/* w32 implementation of get_cache for font backend.