#endif
#include <time.h>
-#ifndef MAC_OSX
-/* On Mac OS X, defining this conflicts with precompiled headers. */
+#ifndef MAC_OS
+/* On Mac OS, defining this conflicts with precompiled headers. */
/* Note on some machines this defines `vector' as a typedef,
so make sure we don't use that name in this file. */
struct textprop_rec *textprops = NULL;
/* Number of elments in textprops. */
int num_textprops = 0;
+ USE_SAFE_ALLOCA;
tail = Qnil;
prev = Qnil;
if (STRINGP (val))
- textprops
- = (struct textprop_rec *) alloca (sizeof (struct textprop_rec) * nargs);
+ SAFE_ALLOCA (textprops, struct textprop_rec *, sizeof (struct textprop_rec) * nargs);
for (argnum = 0; argnum < nargs; argnum++)
{
}
else
{
- XSETFASTINT (elt, SREF (this, thisindex++));
+ XSETFASTINT (elt, SREF (this, thisindex)); thisindex++;
if (some_multibyte
&& (XINT (elt) >= 0240
|| (XINT (elt) >= 0200
last_to_end = textprops[argnum].to + SCHARS (this);
}
}
+
+ SAFE_FREE ();
return val;
}
\f
0, 1);
ret = make_multibyte_string (buf, SCHARS (string), nbytes);
- SAFE_FREE (nbytes);
+ SAFE_FREE ();
return ret;
}
str_to_multibyte (buf, nbytes, SBYTES (string));
ret = make_multibyte_string (buf, SCHARS (string), nbytes);
- SAFE_FREE (nbytes);
+ SAFE_FREE ();
return ret;
}
1, 0);
ret = make_unibyte_string (buf, nchars);
- SAFE_FREE (nchars);
+ SAFE_FREE ();
return ret;
}
return Qnil;
}
+DEFUN ("safe-plist-get", Fsafe_plist_get, Ssafe_plist_get, 2, 2, 0,
+ doc: /* Extract a value from a property list.
+PLIST is a property list, which is a list of the form
+\(PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
+corresponding to the given PROP, or nil if PROP is not
+one of the properties on the list.
+This function never signals an error. */)
+ (plist, prop)
+ Lisp_Object plist;
+ Lisp_Object prop;
+{
+ Lisp_Object tail, halftail;
+
+ /* halftail is used to detect circular lists. */
+ tail = halftail = plist;
+ while (CONSP (tail) && CONSP (XCDR (tail)))
+ {
+ if (EQ (prop, XCAR (tail)))
+ return XCAR (XCDR (tail));
+
+ tail = XCDR (XCDR (tail));
+ halftail = XCDR (halftail);
+ if (EQ (tail, halftail))
+ break;
+ }
+
+ return Qnil;
+}
+
DEFUN ("get", Fget, Sget, 2, 2, 0,
doc: /* Return the value of SYMBOL's PROPNAME property.
This is the last value stored with `(put SYMBOL PROPNAME VALUE)'. */)
(string)
Lisp_Object string;
{
- int len = SBYTES (string);
+ int len;
+ CHECK_STRING (string);
+ len = SBYTES (string);
bzero (SDATA (string), len);
STRING_SET_CHARS (string, len);
STRING_SET_UNIBYTE (string);
int depth;
{
int i, to;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
+
+ GCPRO4 (arg, table, subtable, function);
if (depth == 0)
{
#if 0 /* If the char table has entries for higher characters,
we should report them. */
if (NILP (current_buffer->enable_multibyte_characters))
- return;
+ {
+ UNGCPRO;
+ return;
+ }
#endif
to = CHAR_TABLE_ORDINARY_SLOTS;
}
call2 (function, make_number (c), elt);
}
}
+ UNGCPRO;
}
static void void_call2 P_ ((Lisp_Object a, Lisp_Object b, Lisp_Object c));
for (i = 1; i < nargs; i += 2)
args[i] = separator;
- GCPRO1 (*args);
- gcpro1.nvars = nargs;
ret = Fconcat (nargs, args);
- UNGCPRO;
-
- SAFE_FREE_LISP (nargs);
+ SAFE_FREE ();
return ret;
}
register Lisp_Object len;
register int leni;
register Lisp_Object *args;
- struct gcpro gcpro1;
Lisp_Object ret;
USE_SAFE_ALLOCA;
mapcar1 (leni, args, function, sequence);
- GCPRO1 (*args);
- gcpro1.nvars = leni;
ret = Flist (leni, args);
- UNGCPRO;
-
- SAFE_FREE_LISP (leni);
+ SAFE_FREE ();
return ret;
}
{
ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
Qyes_or_no_p_history, Qnil,
- Qnil));
+ Qnil, Qnil));
if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes"))
{
UNGCPRO;
CHECK_SYMBOL (feature);
+ /* Record the presence of `require' in this file
+ even if the feature specified is already loaded. */
+ LOADHIST_ATTACH (Fcons (Qrequire, feature));
+
tem = Fmemq (feature, Vfeatures);
if (NILP (tem))
int count = SPECPDL_INDEX ();
int nesting = 0;
- LOADHIST_ATTACH (Fcons (Qrequire, feature));
-
/* This is to make sure that loadup.el gives a clear picture
of what files are preloaded and when. */
if (! NILP (Vpurify_flag))
if (encoded_length < 0)
{
/* The encoding wasn't possible. */
- SAFE_FREE (allength);
+ SAFE_FREE ();
error ("Multibyte character in data for base64 encoding");
}
and delete the old. (Insert first in order to preserve markers.) */
SET_PT_BOTH (XFASTINT (beg), ibeg);
insert (encoded, encoded_length);
- SAFE_FREE (allength);
+ SAFE_FREE ();
del_range_byte (ibeg + encoded_length, iend + encoded_length, 1);
/* If point was outside of the region, restore it exactly; else just
if (encoded_length < 0)
{
/* The encoding wasn't possible. */
- SAFE_FREE (allength);
+ SAFE_FREE ();
error ("Multibyte character in data for base64 encoding");
}
encoded_string = make_unibyte_string (encoded, encoded_length);
- SAFE_FREE (allength);
+ SAFE_FREE ();
return encoded_string;
}
if (decoded_length < 0)
{
/* The decoding wasn't possible. */
- SAFE_FREE (allength);
+ SAFE_FREE ();
error ("Invalid base64 data");
}
and delete the old. (Insert first in order to preserve markers.) */
TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg);
insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0);
- SAFE_FREE (allength);
+ SAFE_FREE ();
/* Delete the original text. */
del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars,
else
decoded_string = Qnil;
- SAFE_FREE (length);
+ SAFE_FREE ();
if (!STRINGP (decoded_string))
error ("Invalid base64 data");
h->count = make_number (XFASTINT (h->count) - 1);
}
+ else
+ {
+ prev = idx;
+ }
}
else
{
hash = XUINT (obj);
break;
- case Lisp_Symbol:
- hash = sxhash_string (SDATA (SYMBOL_NAME (obj)),
- SCHARS (SYMBOL_NAME (obj)));
- break;
-
case Lisp_Misc:
hash = XUINT (obj);
break;
+ case Lisp_Symbol:
+ obj = SYMBOL_NAME (obj);
+ /* Fall through. */
+
case Lisp_String:
hash = sxhash_string (SDATA (obj), SCHARS (obj));
break;
defsubr (&Sreverse);
defsubr (&Ssort);
defsubr (&Splist_get);
+ defsubr (&Ssafe_plist_get);
defsubr (&Sget);
defsubr (&Splist_put);
defsubr (&Sput);