allocate_vectorlike (ptrdiff_t len)
{
eassert (0 < len && len <= VECTOR_ELTS_MAX);
- size_t nbytes = header_size + len * word_size;
+ ptrdiff_t nbytes = header_size + len * word_size;
struct Lisp_Vector *p;
MALLOC_BLOCK_INPUT;
{
CHECK_TYPE (FIXNATP (length) && XFIXNAT (length) <= PTRDIFF_MAX,
Qwholenump, length);
- struct Lisp_Vector *p = allocate_vector (XFIXNAT (length));
- for (ptrdiff_t i = 0; i < XFIXNAT (length); i++)
+ return make_vector (XFIXNAT (length), init);
+}
+
+/* Return a new vector of length LENGTH with each element being INIT. */
+
+Lisp_Object
+make_vector (ptrdiff_t length, Lisp_Object init)
+{
+ struct Lisp_Vector *p = allocate_vector (length);
+ for (ptrdiff_t i = 0; i < length; i++)
p->contents[i] = init;
return make_lisp_ptr (p, Lisp_Vectorlike);
}
syms_of_buffer (void)
{
staticpro (&last_overlay_modification_hooks);
- last_overlay_modification_hooks
- = Fmake_vector (make_fixnum (10), Qnil);
+ last_overlay_modification_hooks = make_nil_vector (10);
staticpro (&QSFundamental);
staticpro (&Vbuffer_alist);
integer, it is incremented each time that symbol's function is called. */);
byte_metering_on = false;
- Vbyte_code_meter = Fmake_vector (make_fixnum (256), make_fixnum (0));
+ Vbyte_code_meter = make_nil_vector (256);
DEFSYM (Qbyte_code_meter, "byte-code-meter");
- {
- int i = 256;
- while (i--)
- ASET (Vbyte_code_meter, i,
- Fmake_vector (make_fixnum (256), make_fixnum (0)));
- }
+ for (int i = 0; i < 256; i++)
+ ASET (Vbyte_code_meter, i, make_vector (256, make_fixnum (0)));
#endif
}
case 'U': /* Up event from last k or K. */
if (!NILP (up_event))
{
- args[i] = Fmake_vector (make_fixnum (1), up_event);
+ args[i] = make_vector (1, up_event);
up_event = Qnil;
visargs[i] = Fkey_description (args[i], Qnil);
}
set_char_table_defalt (val, MAKE_CATEGORY_SET);
for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
set_char_table_contents (val, i, MAKE_CATEGORY_SET);
- Fset_char_table_extra_slot (val, make_fixnum (0),
- Fmake_vector (make_fixnum (95), Qnil));
+ Fset_char_table_extra_slot (val, make_fixnum (0), make_nil_vector (95));
return val;
}
/* Set a category set which contains nothing to the default. */
set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
Fset_char_table_extra_slot (Vstandard_category_table, make_fixnum (0),
- Fmake_vector (make_fixnum (95), Qnil));
+ make_nil_vector (95));
}
void
syms_of_ccl (void)
{
staticpro (&Vccl_program_table);
- Vccl_program_table = Fmake_vector (make_fixnum (32), Qnil);
+ Vccl_program_table = make_nil_vector (32);
DEFSYM (Qccl, "ccl");
DEFSYM (Qcclp, "cclp");
DEFVAR_LISP ("code-conversion-map-vector", Vcode_conversion_map_vector,
doc: /* Vector of code conversion maps. */);
- Vcode_conversion_map_vector = Fmake_vector (make_fixnum (16), Qnil);
+ Vcode_conversion_map_vector = make_nil_vector (16);
DEFVAR_LISP ("font-ccl-encoder-alist", Vfont_ccl_encoder_alist,
doc: /* Alist of fontname patterns vs corresponding CCL program.
Vector recording all translation tables ever defined.
Each element is a pair (SYMBOL . TABLE) relating the table to the
symbol naming it. The ID of a translation table is an index into this vector. */);
- Vtranslation_table_vector = Fmake_vector (make_fixnum (16), Qnil);
+ Vtranslation_table_vector = make_nil_vector (16);
DEFVAR_LISP ("auto-fill-chars", Vauto_fill_chars,
doc: /*
{
int n = CODE_POINT_TO_INDEX (charset, max_code) + 1;
- vec = Fmake_vector (make_fixnum (n), make_fixnum (-1));
+ vec = make_vector (n, make_fixnum (-1));
set_charset_attr (charset, charset_decoder, vec);
}
else
Fcons (intern ("define-charset-internal"),
make_fixnum (nargs)));
- attrs = Fmake_vector (make_fixnum (charset_attr_max), Qnil);
+ attrs = make_nil_vector (charset_attr_max);
CHECK_SYMBOL (args[charset_arg_name]);
ASET (attrs, charset_name, args[charset_arg_name]);
from_byte = CHAR_TO_BYTE (from);
- charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
+ charsets = make_nil_vector (charset_table_used);
while (1)
{
find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from,
only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
(Lisp_Object str, Lisp_Object table)
{
- Lisp_Object charsets;
- int i;
- Lisp_Object val;
-
CHECK_STRING (str);
- charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
+ Lisp_Object charsets = make_nil_vector (charset_table_used);
find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str),
charsets, table,
STRING_MULTIBYTE (str));
- val = Qnil;
- for (i = charset_table_used - 1; i >= 0; i--)
+ Lisp_Object val = Qnil;
+ for (int i = charset_table_used - 1; i >= 0; i--)
if (!NILP (AREF (charsets, i)))
val = Fcons (CHARSET_NAME (charset_table + i), val);
return val;
}
size = CHAR_TABLE_STANDARD_SLOTS + n_extras;
- vector = Fmake_vector (make_fixnum (size), init);
+ vector = make_vector (size, init);
XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
set_char_table_parent (vector, Qnil);
set_char_table_purpose (vector, purpose);
Lisp_Object
copy_char_table (Lisp_Object table)
{
- Lisp_Object copy;
int size = PVSIZE (table);
- int i;
-
- copy = Fmake_vector (make_fixnum (size), Qnil);
+ Lisp_Object copy = make_nil_vector (size);
XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
- for (i = 0; i < chartab_size[0]; i++)
+ for (int i = 0; i < chartab_size[0]; i++)
set_char_table_contents
(copy, i,
(SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
: XCHAR_TABLE (table)->contents[i]));
set_char_table_ascii (copy, char_table_ascii (copy));
size -= CHAR_TABLE_STANDARD_SLOTS;
- for (i = 0; i < size; i++)
+ for (int i = 0; i < size; i++)
set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
set_char_table_extras (table, 4,
CALLN (Fvconcat,
XCHAR_TABLE (table)->extras[4],
- Fmake_vector (make_fixnum (1), value)));
+ make_vector (1, value)));
return make_fixnum (i);
}
usage: (define-coding-system-internal ...) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
- Lisp_Object name;
- Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */
- Lisp_Object attrs; /* Vector of attributes. */
- Lisp_Object eol_type;
- Lisp_Object aliases;
- Lisp_Object coding_type, charset_list, safe_charsets;
enum coding_category category;
- Lisp_Object tail, val;
int max_charset_id = 0;
- int i;
if (nargs < coding_arg_max)
goto short_args;
- attrs = Fmake_vector (make_fixnum (coding_attr_last_index), Qnil);
+ Lisp_Object attrs = make_nil_vector (coding_attr_last_index);
- name = args[coding_arg_name];
+ Lisp_Object name = args[coding_arg_name];
CHECK_SYMBOL (name);
ASET (attrs, coding_attr_base_name, name);
- val = args[coding_arg_mnemonic];
+ Lisp_Object val = args[coding_arg_mnemonic];
if (! STRINGP (val))
CHECK_CHARACTER (val);
ASET (attrs, coding_attr_mnemonic, val);
- coding_type = args[coding_arg_coding_type];
+ Lisp_Object coding_type = args[coding_arg_coding_type];
CHECK_SYMBOL (coding_type);
ASET (attrs, coding_attr_type, coding_type);
- charset_list = args[coding_arg_charset_list];
+ Lisp_Object charset_list = args[coding_arg_charset_list];
if (SYMBOLP (charset_list))
{
if (EQ (charset_list, Qiso_2022))
error ("Invalid charset-list");
charset_list = Vemacs_mule_charset_list;
}
- for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
{
if (! RANGED_FIXNUMP (0, XCAR (tail), INT_MAX - 1))
error ("Invalid charset-list");
else
{
charset_list = Fcopy_sequence (charset_list);
- for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
{
struct charset *charset;
}
ASET (attrs, coding_attr_charset_list, charset_list);
- safe_charsets = make_uninit_string (max_charset_id + 1);
+ Lisp_Object safe_charsets = make_uninit_string (max_charset_id + 1);
memset (SDATA (safe_charsets), 255, max_charset_id + 1);
- for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
SSET (safe_charsets, XFIXNAT (XCAR (tail)), 0);
ASET (attrs, coding_attr_safe_charsets, safe_charsets);
If Nth element is a list of charset IDs, N is the first byte
of one of them. The list is sorted by dimensions of the
charsets. A charset of smaller dimension comes first. */
- val = Fmake_vector (make_fixnum (256), Qnil);
+ val = make_nil_vector (256);
- for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
{
struct charset *charset = CHARSET_FROM_ID (XFIXNAT (XCAR (tail)));
int dim = CHARSET_DIMENSION (charset);
if (CHARSET_ASCII_COMPATIBLE_P (charset))
ASET (attrs, coding_attr_ascii_compat, Qt);
- for (i = charset->code_space[idx];
+ for (int i = charset->code_space[idx];
i <= charset->code_space[idx + 1]; i++)
{
Lisp_Object tmp, tmp2;
val = args[coding_arg_ccl_valids];
valids = Fmake_string (make_fixnum (256), make_fixnum (0), Qnil);
- for (tail = val; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = val; CONSP (tail); tail = XCDR (tail))
{
int from, to;
XCAR (val), make_fixnum (255));
to = XFIXNUM (XCDR (val));
}
- for (i = from; i <= to; i++)
+ for (int i = from; i <= to; i++)
SSET (valids, i, 1);
}
ASET (attrs, coding_attr_ccl_valids, valids);
initial = Fcopy_sequence (args[coding_arg_iso2022_initial]);
CHECK_VECTOR (initial);
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
val = AREF (initial, i);
if (! NILP (val))
CHECK_FIXNUM_CDR (reg_usage);
request = Fcopy_sequence (args[coding_arg_iso2022_request]);
- for (tail = request; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = request; CONSP (tail); tail = XCDR (tail))
{
int id;
Lisp_Object tmp1;
CHECK_CHARSET_GET_ID (tmp1, id);
CHECK_FIXNAT_CDR (val);
if (XFIXNUM (XCDR (val)) >= 4)
- error ("Invalid graphic register number: %"pI"d", XFIXNUM (XCDR (val)));
+ error ("Invalid graphic register number: %"pI"d",
+ XFIXNUM (XCDR (val)));
XSETCAR (val, make_fixnum (id));
}
flags = args[coding_arg_iso2022_flags];
CHECK_FIXNAT (flags);
- i = XFIXNUM (flags) & INT_MAX;
+ int i = XFIXNUM (flags) & INT_MAX;
if (EQ (args[coding_arg_charset_list], Qiso_2022))
i |= CODING_ISO_FLAG_FULL_SUPPORT;
flags = make_fixnum (i);
Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
CODING_ATTR_PLIST (attrs))));
- eol_type = args[coding_arg_eol_type];
+ Lisp_Object eol_type = args[coding_arg_eol_type];
if (! NILP (eol_type)
&& ! EQ (eol_type, Qunix)
&& ! EQ (eol_type, Qdos)
&& ! EQ (eol_type, Qmac))
error ("Invalid eol-type");
- aliases = list1 (name);
+ Lisp_Object aliases = list1 (name);
if (NILP (eol_type))
{
eol_type = make_subsidiaries (name);
- for (i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++)
{
Lisp_Object this_spec, this_name, this_aliases, this_eol_type;
}
}
- spec_vec = make_uninit_vector (3);
+ Lisp_Object spec_vec = make_uninit_vector (3);
ASET (spec_vec, 0, attrs);
ASET (spec_vec, 1, aliases);
ASET (spec_vec, 2, eol_type);
Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
Vcoding_system_alist);
- {
- int id = coding_categories[category].id;
-
- if (id < 0 || EQ (name, CODING_ID_NAME (id)))
+ int id = coding_categories[category].id;
+ if (id < 0 || EQ (name, CODING_ID_NAME (id)))
setup_coding_system (name, &coding_categories[category]);
- }
return Qnil;
DEFSYM (QCpre_write_conversion, ":pre-write-conversion");
DEFSYM (QCascii_compatible_p, ":ascii-compatible-p");
- Vcoding_category_table
- = Fmake_vector (make_fixnum (coding_category_max), Qnil);
+ Vcoding_category_table = make_nil_vector (coding_category_max);
staticpro (&Vcoding_category_table);
/* Followings are target of code detection. */
ASET (Vcoding_category_table, coding_category_iso_7,
`accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file
or reading output of a subprocess.
Only 128th through 159th elements have a meaning. */);
- Vlatin_extra_code_table = Fmake_vector (make_fixnum (256), Qnil);
+ Vlatin_extra_code_table = make_nil_vector (256);
DEFVAR_LISP ("select-safe-coding-system-function",
Vselect_safe_coding_system_function,
COMPONENTS (converted to a vector COMPONENTS-VEC) or, if it is
nil, vector of characters in the composition range. */
if (FIXNUMP (components))
- key = Fmake_vector (make_fixnum (1), components);
+ key = make_vector (1, components);
else if (STRINGP (components) || CONSP (components))
key = Fvconcat (1, &components);
else if (VECTORP (components))
composition_gstring_put_cache (Lisp_Object gstring, ptrdiff_t len)
{
struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
- EMACS_UINT hash;
- Lisp_Object header, copy;
- ptrdiff_t i;
-
- header = LGSTRING_HEADER (gstring);
- hash = h->test.hashfn (&h->test, header);
+ Lisp_Object header = LGSTRING_HEADER (gstring);
+ EMACS_UINT hash = h->test.hashfn (&h->test, header);
if (len < 0)
{
- ptrdiff_t j, glyph_len = LGSTRING_GLYPH_LEN (gstring);
- for (j = 0; j < glyph_len; j++)
- if (NILP (LGSTRING_GLYPH (gstring, j)))
+ ptrdiff_t glyph_len = LGSTRING_GLYPH_LEN (gstring);
+ for (len = 0; len < glyph_len; len++)
+ if (NILP (LGSTRING_GLYPH (gstring, len)))
break;
- len = j;
}
- copy = Fmake_vector (make_fixnum (len + 2), Qnil);
+ Lisp_Object copy = make_nil_vector (len + 2);
LGSTRING_SET_HEADER (copy, Fcopy_sequence (header));
- for (i = 0; i < len; i++)
+ for (ptrdiff_t i = 0; i < len; i++)
LGSTRING_SET_GLYPH (copy, i, Fcopy_sequence (LGSTRING_GLYPH (gstring, i)));
- i = hash_put (h, LGSTRING_HEADER (copy), copy, hash);
- LGSTRING_SET_ID (copy, make_fixnum (i));
+ ptrdiff_t id = hash_put (h, LGSTRING_HEADER (copy), copy, hash);
+ LGSTRING_SET_ID (copy, make_fixnum (id));
return copy;
}
return gstring;
if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos)
- gstring_work = Fmake_vector (make_fixnum (topos - frompos + 2), Qnil);
+ gstring_work = make_nil_vector (topos - frompos + 2);
LGSTRING_SET_HEADER (gstring_work, header);
LGSTRING_SET_ID (gstring_work, Qnil);
fill_gstring_body (gstring_work);
staticpro (&gstring_work_headers);
gstring_work_headers = make_uninit_vector (8);
for (i = 0; i < 8; i++)
- ASET (gstring_work_headers, i, Fmake_vector (make_fixnum (i + 2), Qnil));
+ ASET (gstring_work_headers, i, make_nil_vector (i + 2));
staticpro (&gstring_work);
- gstring_work = Fmake_vector (make_fixnum (10), Qnil);
+ gstring_work = make_nil_vector (10);
/* Text property `composition' should be nonsticky by default. */
Vtext_property_default_nonsticky
LGLYPH_SIZE
};
-#define LGLYPH_NEW() Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil)
+#define LGLYPH_NEW() make_nil_vector (LGLYPH_SIZE)
#define LGLYPH_FROM(g) XFIXNUM (AREF ((g), LGLYPH_IX_FROM))
#define LGLYPH_TO(g) XFIXNUM (AREF ((g), LGLYPH_IX_TO))
#define LGLYPH_CHAR(g) XFIXNUM (AREF ((g), LGLYPH_IX_CHAR))
|| n + 20 < ASIZE (state) / 2)
/* Add 20 extra so we grow it less often. */
{
- state = Fmake_vector (make_fixnum (n + 20), Qlambda);
+ state = make_vector (n + 20, Qlambda);
if (! NILP (variable))
Fset (variable, state);
else
defsubr (&Sdump_redisplay_history);
#endif
- frame_and_buffer_state = Fmake_vector (make_fixnum (20), Qlambda);
+ frame_and_buffer_state = make_vector (20, Qlambda);
staticpro (&frame_and_buffer_state);
/* This is the "purpose" slot of a display table. */
if (target_type == Lisp_Cons)
val = Fmake_list (make_fixnum (result_len), Qnil);
else if (target_type == Lisp_Vectorlike)
- val = Fmake_vector (make_fixnum (result_len), Qnil);
+ val = make_nil_vector (result_len);
else if (some_multibyte)
val = make_uninit_multibyte_string (result_len, result_len_byte);
else
#ifdef DAY_1
else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */
{
- Lisp_Object v = Fmake_vector (make_fixnum (7), Qnil);
+ Lisp_Object v = make_nil_vector (7);
const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
int i;
synchronize_system_time_locale ();
#ifdef MON_1
else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */
{
- Lisp_Object v = Fmake_vector (make_fixnum (12), Qnil);
+ Lisp_Object v = make_nil_vector (12);
const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
MON_8, MON_9, MON_10, MON_11, MON_12};
- int i;
synchronize_system_time_locale ();
- for (i = 0; i < 12; i++)
+ for (int i = 0; i < 12; i++)
{
str = nl_langinfo (months[i]);
AUTO_STRING (val, str);
h->rehash_threshold = rehash_threshold;
h->rehash_size = rehash_size;
h->count = 0;
- h->key_and_value = Fmake_vector (make_fixnum (2 * size), Qnil);
- h->hash = Fmake_vector (make_fixnum (size), Qnil);
- h->next = Fmake_vector (make_fixnum (size), make_fixnum (-1));
- h->index = Fmake_vector (make_fixnum (index_size), make_fixnum (-1));
+ h->key_and_value = make_nil_vector (2 * size);
+ h->hash = make_nil_vector (size);
+ h->next = make_vector (size, make_fixnum (-1));
+ h->index = make_vector (index_size, make_fixnum (-1));
h->pure = pure;
/* Set up the free list. */
set_hash_key_and_value (h, larger_vector (h->key_and_value,
2 * (new_size - old_size), -1));
set_hash_hash (h, larger_vector (h->hash, new_size - old_size, -1));
- set_hash_index (h, Fmake_vector (make_fixnum (index_size),
- make_fixnum (-1)));
+ set_hash_index (h, make_vector (index_size, make_fixnum (-1)));
set_hash_next (h, larger_vecalloc (h->next, new_size - old_size, -1));
/* Update the free list. Do it so that new entries are added at
if (! noerror)
return -1;
eassert (len < 255);
- elt = Fmake_vector (make_fixnum (2), make_fixnum (100));
+ elt = make_vector (2, make_fixnum (100));
ASET (elt, 1, val);
ASET (font_style_table, prop - FONT_WEIGHT_INDEX,
- CALLN (Fvconcat, table, Fmake_vector (make_fixnum (1), elt)));
+ CALLN (Fvconcat, table, make_vector (1, elt)));
return (100 << 8) | (i << 4);
}
else
Lisp_Object
font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record)
{
- Lisp_Object val = Fmake_vector (make_fixnum (8), Qnil);
+ Lisp_Object val = make_nil_vector (8);
if (value_format & OTF_XPlacement)
ASET (val, 0, make_fixnum (value_record->XPlacement));
Lisp_Object
font_otf_Anchor (OTF_Anchor *anchor)
{
- Lisp_Object val;
-
- val = Fmake_vector (make_fixnum (anchor->AnchorFormat + 1), Qnil);
+ Lisp_Object val = make_nil_vector (anchor->AnchorFormat + 1);
ASET (val, 0, make_fixnum (anchor->XCoordinate));
ASET (val, 1, make_fixnum (anchor->YCoordinate));
if (anchor->AnchorFormat == 2)
static Lisp_Object
build_style_table (const struct table_entry *entry, int nelement)
{
- int i, j;
- Lisp_Object table, elt;
-
- table = make_uninit_vector (nelement);
- for (i = 0; i < nelement; i++)
+ Lisp_Object table = make_uninit_vector (nelement);
+ for (int i = 0; i < nelement; i++)
{
- for (j = 0; entry[i].names[j]; j++);
- elt = Fmake_vector (make_fixnum (j + 1), Qnil);
+ int j;
+ for (j = 0; entry[i].names[j]; j++)
+ continue;
+ Lisp_Object elt = make_nil_vector (j + 1);
ASET (elt, 0, make_fixnum (entry[i].numeric));
for (j = 0; entry[i].names[j]; j++)
ASET (elt, j + 1, intern_c_string (entry[i].names[j]));
scratch_font_prefer = Ffont_spec (0, NULL);
staticpro (&Vfont_log_deferred);
- Vfont_log_deferred = Fmake_vector (make_fixnum (3), Qnil);
+ Vfont_log_deferred = make_nil_vector (3);
#if 0
#ifdef HAVE_LIBOTF
ASET ((rfont_def), 3, make_fixnum (score))
#define RFONT_DEF_NEW(rfont_def, font_def) \
do { \
- (rfont_def) = Fmake_vector (make_fixnum (4), Qnil); \
- ASET ((rfont_def), 1, (font_def)); \
- RFONT_DEF_SET_SCORE ((rfont_def), 0); \
- } while (0)
+ (rfont_def) = make_nil_vector (4); \
+ ASET (rfont_def, 1, font_def); \
+ RFONT_DEF_SET_SCORE (rfont_def, 0); \
+ } while (false)
/* Return the element of FONTSET for the character C. If FONTSET is a
#define FONTSET_ADD(fontset, range, elt, add) \
(NILP (add) \
? (NILP (range) \
- ? (set_fontset_fallback \
- (fontset, Fmake_vector (make_fixnum (1), (elt)))) \
- : ((void) \
- Fset_char_table_range (fontset, range, \
- Fmake_vector (make_fixnum (1), elt)))) \
+ ? set_fontset_fallback (fontset, make_vector (1, elt)) \
+ : (void) Fset_char_table_range (fontset, range, make_vector (1, elt))) \
: fontset_add ((fontset), (range), (elt), (add)))
static void
Lisp_Object args[2];
int idx = (EQ (add, Qappend) ? 0 : 1);
- args[1 - idx] = Fmake_vector (make_fixnum (1), elt);
+ args[1 - idx] = make_vector (1, elt);
if (CONSP (range))
{
{
/* We found a font. Open it and insert a new element for
that font in VEC. */
- Lisp_Object new_vec;
int j;
font_object = font_open_for_lface (f, font_entity, face->lface,
RFONT_DEF_NEW (rfont_def, font_def);
RFONT_DEF_SET_OBJECT (rfont_def, font_object);
RFONT_DEF_SET_SCORE (rfont_def, RFONT_DEF_SCORE (rfont_def));
- new_vec = Fmake_vector (make_fixnum (ASIZE (vec) + 1), Qnil);
+ Lisp_Object new_vec = make_nil_vector (ASIZE (vec) + 1);
found_index++;
for (j = 0; j < found_index; j++)
ASET (new_vec, j, AREF (vec, j));
Lisp_Object
dump_fontset (Lisp_Object fontset)
{
- Lisp_Object vec;
-
- vec = Fmake_vector (make_fixnum (3), Qnil);
+ Lisp_Object vec = make_nil_vector (3);
ASET (vec, 0, FONTSET_ID (fontset));
if (BASE_FONTSET_P (fontset))
Vcached_fontset_data = Qnil;
staticpro (&Vcached_fontset_data);
- Vfontset_table = Fmake_vector (make_fixnum (32), Qnil);
+ Vfontset_table = make_nil_vector (32);
staticpro (&Vfontset_table);
Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
{
*put_func = xpm_put_color_table_v;
*get_func = xpm_get_color_table_v;
- return Fmake_vector (make_fixnum (256), Qnil);
+ return make_nil_vector (256);
}
static void
size_t size = json_array_size (json);
if (FIXNUM_OVERFLOW_P (size))
overflow_error ();
- Lisp_Object result = Fmake_vector (make_fixed_natnum (size), Qunbound);
+ Lisp_Object result = make_vector (size, Qunbound);
for (ptrdiff_t i = 0; i < size; ++i)
ASET (result, i,
json_to_lisp (json_array_get (json, i), conf));
{
if (! VECTORP (*symbol_table)
|| ASIZE (*symbol_table) != table_size)
- {
- Lisp_Object size;
-
- XSETFASTINT (size, table_size);
- *symbol_table = Fmake_vector (size, Qnil);
- }
+ *symbol_table = make_nil_vector (table_size);
value = AREF (*symbol_table, symbol_num);
}
if (!NILP (old))
menu_bar_items_vector = old;
else
- menu_bar_items_vector = Fmake_vector (make_fixnum (24), Qnil);
+ menu_bar_items_vector = make_nil_vector (24);
menu_bar_items_index = 0;
/* Build our list of keymaps.
/* Create item_properties vector if necessary. */
if (NILP (item_properties))
- item_properties
- = Fmake_vector (make_fixnum (ITEM_PROPERTY_ENABLE + 1), Qnil);
+ item_properties = make_nil_vector (ITEM_PROPERTY_ENABLE + 1);
/* Initialize optional entries. */
for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++)
set_prop (i, Qnil);
}
else
- tool_bar_item_properties
- = Fmake_vector (make_fixnum (TOOL_BAR_ITEM_NSLOTS), Qnil);
+ tool_bar_item_properties = make_nil_vector (TOOL_BAR_ITEM_NSLOTS);
/* Set defaults. */
set_prop (TOOL_BAR_ITEM_KEY, key);
if (VECTORP (reuse))
tool_bar_items_vector = reuse;
else
- tool_bar_items_vector = Fmake_vector (make_fixnum (64), Qnil);
+ tool_bar_items_vector = make_nil_vector (64);
ntool_bar_items = 0;
}
}
}
- button_down_location = Fmake_vector (make_fixnum (5), Qnil);
+ button_down_location = make_nil_vector (5);
staticpro (&button_down_location);
- mouse_syms = Fmake_vector (make_fixnum (5), Qnil);
+ mouse_syms = make_nil_vector (5);
staticpro (&mouse_syms);
- wheel_syms = Fmake_vector (make_fixnum (ARRAYELTS (lispy_wheel_names)),
- Qnil);
+ wheel_syms = make_nil_vector (ARRAYELTS (lispy_wheel_names));
staticpro (&wheel_syms);
{
int i;
int len = ARRAYELTS (modifier_names);
- modifier_symbols = Fmake_vector (make_fixnum (len), Qnil);
+ modifier_symbols = make_nil_vector (len);
for (i = 0; i < len; i++)
if (modifier_names[i])
ASET (modifier_symbols, i, intern_c_string (modifier_names[i]));
staticpro (&modifier_symbols);
}
- recent_keys = Fmake_vector (make_fixnum (NUM_RECENT_KEYS), Qnil);
+ recent_keys = make_nil_vector (NUM_RECENT_KEYS);
staticpro (&recent_keys);
- this_command_keys = Fmake_vector (make_fixnum (40), Qnil);
+ this_command_keys = make_nil_vector (40);
staticpro (&this_command_keys);
- raw_keybuf = Fmake_vector (make_fixnum (30), Qnil);
+ raw_keybuf = make_nil_vector (30);
staticpro (&raw_keybuf);
DEFSYM (Qcommand_execute, "command-execute");
if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
{ /* DEF is apparently an XEmacs-style keyboard macro. */
- Lisp_Object tmp = Fmake_vector (make_fixnum (ASIZE (def)), Qnil);
+ Lisp_Object tmp = make_nil_vector (ASIZE (def));
ptrdiff_t i = ASIZE (def);
while (--i >= 0)
{
we don't have to deal with the possibility of a string. */
if (STRINGP (prefix))
{
- int i, i_byte, c;
- Lisp_Object copy;
-
- copy = Fmake_vector (make_fixnum (SCHARS (prefix)), Qnil);
- for (i = 0, i_byte = 0; i < SCHARS (prefix);)
+ ptrdiff_t i_byte = 0;
+ Lisp_Object copy = make_nil_vector (SCHARS (prefix));
+ for (ptrdiff_t i = 0; i < SCHARS (prefix); )
{
- int i_before = i;
-
+ ptrdiff_t i_before = i;
+ int c;
FETCH_STRING_CHAR_ADVANCE (c, prefix, i, i_byte);
if (SINGLE_BYTE_CHAR_P (c) && (c & 0200))
c ^= 0200 | meta_modifier;
/* This vector gets used to present single keys to Flookup_key. Since
that is done once per keymap element, we don't want to cons up a
fresh vector every time. */
- kludge = Fmake_vector (make_fixnum (1), Qnil);
+ kludge = make_nil_vector (1);
definition = Qnil;
map = call1 (Qkeymap_canonicalize, map);
/* This vector gets used to present single keys to Flookup_key. Since
that is done once per vector element, we don't want to cons up a
fresh vector every time. */
- kludge = Fmake_vector (make_fixnum (1), Qnil);
+ kludge = make_nil_vector (1);
if (partial)
suppress = intern ("suppress-keymap");
DEFSYM (Qremap, "remap");
DEFSYM (QCadvertised_binding, ":advertised-binding");
- command_remapping_vector = Fmake_vector (make_fixnum (2), Qremap);
+ command_remapping_vector = make_vector (2, Qremap);
staticpro (&command_remapping_vector);
where_is_cache_keymaps = Qt;
}
extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
+extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object);
extern void make_byte_code (struct Lisp_Vector *);
extern struct Lisp_Vector *allocate_vector (ptrdiff_t);
return v;
}
+/* Make a vector of SIZE nils. */
+
+INLINE Lisp_Object
+make_nil_vector (ptrdiff_t size)
+{
+ Lisp_Object vec = make_uninit_vector (size);
+ memclear (XVECTOR (vec)->contents, size * word_size);
+ return vec;
+}
+
extern struct Lisp_Vector *allocate_pseudovector (int, int, int,
enum pvec_type);
static Lisp_Object
read_vector (Lisp_Object readcharfun, bool bytecodeflag)
{
- ptrdiff_t i, size;
- Lisp_Object *ptr;
- Lisp_Object tem, item, vector;
- struct Lisp_Cons *otem;
- Lisp_Object len;
-
- tem = read_list (1, readcharfun);
- len = Flength (tem);
- if (bytecodeflag && XFIXNAT (len) <= COMPILED_STACK_DEPTH)
+ Lisp_Object tem = read_list (1, readcharfun);
+ Lisp_Object len = Flength (tem);
+ ptrdiff_t size = XFIXNAT (len);
+ if (bytecodeflag && size <= COMPILED_STACK_DEPTH)
error ("Invalid byte code");
- vector = Fmake_vector (len, Qnil);
+ Lisp_Object vector = make_nil_vector (size);
- size = XFIXNAT (len);
- ptr = XVECTOR (vector)->contents;
- for (i = 0; i < size; i++)
+ Lisp_Object *ptr = XVECTOR (vector)->contents;
+ for (ptrdiff_t i = 0; i < size; i++)
{
- item = Fcar (tem);
+ Lisp_Object item = Fcar (tem);
/* If `load-force-doc-strings' is t when reading a lazily-loaded
bytecode object, the docstring containing the bytecode and
constants values must be treated as unibyte and passed to
if (!CONSP (item))
error ("Invalid byte code");
- otem = XCONS (item);
+ struct Lisp_Cons *otem = XCONS (item);
bytestr = XCAR (item);
item = XCDR (item);
free_cons (otem);
}
}
ASET (vector, i, item);
- otem = XCONS (tem);
+ struct Lisp_Cons *otem = XCONS (tem);
tem = Fcdr (tem);
free_cons (otem);
}
void
init_obarray (void)
{
- Vobarray = Fmake_vector (make_fixnum (OBARRAY_SIZE), make_fixnum (0));
+ Vobarray = make_vector (OBARRAY_SIZE, make_fixnum (0));
initial_obarray = Vobarray;
staticpro (&initial_obarray);
if (NILP (lglyph))
{
- lglyph = Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil);
+ lglyph = make_nil_vector (LGLYPH_SIZE);
LGSTRING_SET_GLYPH (lgstring, i, lglyph);
}
wadjust = lround (gl->advance);
if (xoff != 0 || yoff != 0 || wadjust != metrics.width)
{
- Lisp_Object vec;
-
- vec = Fmake_vector (make_fixnum (3), Qnil);
+ Lisp_Object vec = make_uninit_vector (3);
ASET (vec, 0, make_fixnum (xoff));
ASET (vec, 1, make_fixnum (yoff));
ASET (vec, 2, make_fixnum (wadjust));
if (NILP (menu_items))
{
menu_items_allocated = 60;
- menu_items = Fmake_vector (make_fixnum (menu_items_allocated), Qnil);
+ menu_items = make_nil_vector (menu_items_allocated);
}
menu_items_inuse = Qt;
int primary_monitor,
const char *source)
{
- Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+ Lisp_Object monitor_frames = make_nil_vector (n_monitors);
Lisp_Object frame, rest;
NSArray *screens = [NSScreen screens];
int i;
conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
{
Lisp_Object address;
- ptrdiff_t i;
unsigned char *cp;
struct Lisp_Vector *p;
{
DECLARE_POINTER_ALIAS (sin, struct sockaddr_in, sa);
len = sizeof (sin->sin_addr) + 1;
- address = Fmake_vector (make_fixnum (len), Qnil);
+ address = make_uninit_vector (len);
p = XVECTOR (address);
p->contents[--len] = make_fixnum (ntohs (sin->sin_port));
cp = (unsigned char *) &sin->sin_addr;
DECLARE_POINTER_ALIAS (sin6, struct sockaddr_in6, sa);
DECLARE_POINTER_ALIAS (ip6, uint16_t, &sin6->sin6_addr);
len = sizeof (sin6->sin6_addr) / 2 + 1;
- address = Fmake_vector (make_fixnum (len), Qnil);
+ address = make_uninit_vector (len);
p = XVECTOR (address);
p->contents[--len] = make_fixnum (ntohs (sin6->sin6_port));
- for (i = 0; i < len; i++)
+ for (ptrdiff_t i = 0; i < len; i++)
p->contents[i] = make_fixnum (ntohs (ip6[i]));
return address;
}
#endif
default:
len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
- address = Fcons (make_fixnum (sa->sa_family),
- Fmake_vector (make_fixnum (len), Qnil));
+ address = Fcons (make_fixnum (sa->sa_family), make_nil_vector (len));
p = XVECTOR (XCDR (address));
cp = (unsigned char *) &sa->sa_family + sizeof (sa->sa_family);
break;
}
- i = 0;
- while (i < len)
- p->contents[i++] = make_fixnum (*cp++);
+ for (ptrdiff_t i = 0; i < len; i++)
+ p->contents[i] = make_fixnum (*cp++);
return address;
}
Lisp_Object res = Qnil;
Lisp_Object elt;
int s;
- bool any = 0;
+ bool any = false;
ptrdiff_t count;
#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \
&& defined HAVE_GETIFADDRS && defined LLADDR)
if (flags < 0 && sizeof (rq.ifr_flags) < sizeof (flags))
flags = (unsigned short) rq.ifr_flags;
- any = 1;
+ any = true;
for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++)
{
if (flags & fp->flag_bit)
#if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
{
- Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
- register struct Lisp_Vector *p = XVECTOR (hwaddr);
- int n;
+ Lisp_Object hwaddr = make_uninit_vector (6);
+ struct Lisp_Vector *p = XVECTOR (hwaddr);
- any = 1;
- for (n = 0; n < 6; n++)
+ any = true;
+ for (int n = 0; n < 6; n++)
p->contents[n] = make_fixnum (((unsigned char *)
&rq.ifr_hwaddr.sa_data[0])
[n]);
#elif defined (HAVE_GETIFADDRS) && defined (LLADDR)
if (getifaddrs (&ifap) != -1)
{
- Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
- register struct Lisp_Vector *p = XVECTOR (hwaddr);
- struct ifaddrs *it;
+ Lisp_Object hwaddr = make_nil_vector (6);
+ struct Lisp_Vector *p = XVECTOR (hwaddr);
- for (it = ifap; it != NULL; it = it->ifa_next)
+ for (struct ifaddrs *it = ifap; it != NULL; it = it->ifa_next)
{
DECLARE_POINTER_ALIAS (sdl, struct sockaddr_dl, it->ifa_addr);
unsigned char linkaddr[6];
res = Fcons (elt, res);
elt = Qnil;
-#if defined (SIOCGIFNETMASK) && (defined (HAVE_STRUCT_IFREQ_IFR_NETMASK) || defined (HAVE_STRUCT_IFREQ_IFR_ADDR))
+#if (defined SIOCGIFNETMASK \
+ && (defined HAVE_STRUCT_IFREQ_IFR_NETMASK \
+ || defined HAVE_STRUCT_IFREQ_IFR_ADDR))
if (ioctl (s, SIOCGIFNETMASK, &rq) == 0)
{
- any = 1;
+ any = true;
#ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK
elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask));
#else
#if defined (SIOCGIFBRDADDR) && defined (HAVE_STRUCT_IFREQ_IFR_BROADADDR)
if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
{
- any = 1;
- elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr));
+ any = true;
+ elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof rq.ifr_broadaddr);
}
#endif
res = Fcons (elt, res);
#if defined (SIOCGIFADDR) && defined (HAVE_STRUCT_IFREQ_IFR_ADDR)
if (ioctl (s, SIOCGIFADDR, &rq) == 0)
{
- any = 1;
+ any = true;
elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
}
#endif
with the vectors we'll put in them. */
ptrdiff_t i = ASIZE (h->key_and_value) >> 1;
while (i > 0)
- set_hash_key_slot (h, --i,
- Fmake_vector (make_fixnum (max_stack_depth), Qnil));
+ set_hash_key_slot (h, --i, make_nil_vector (max_stack_depth));
return log;
}
cpu_log = (profiler_cpu_running
? make_log (profiler_log_size, profiler_max_stack_depth)
: Qnil);
- Fputhash (Fmake_vector (make_fixnum (1), QAutomatic_GC),
+ Fputhash (make_vector (1, QAutomatic_GC),
make_fixnum (cpu_gc_count),
result);
cpu_gc_count = 0;
char *sequence = tgetstr (keys[i].cap, address);
if (sequence)
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
- Fmake_vector (make_fixnum (1),
- intern (keys[i].name)));
+ make_vector (1, intern (keys[i].name)));
}
/* The uses of the "k0" capability are inconsistent; sometimes it
/* Define f0 first, so that f10 takes precedence in case the
key sequences happens to be the same. */
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
- Fmake_vector (make_fixnum (1), intern ("f0")));
+ make_vector (1, intern ("f0")));
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
- Fmake_vector (make_fixnum (1), intern ("f10")));
+ make_vector (1, intern ("f10")));
}
else if (k0)
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
- Fmake_vector (make_fixnum (1), intern (k0_name)));
+ make_vector (1, intern (k0_name)));
}
/* Set up cookies for numbered function keys above f10. */
{
sprintf (fkey, "f%d", i);
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
- Fmake_vector (make_fixnum (1),
- intern (fkey)));
+ make_vector (1, intern (fkey)));
}
}
}
char *sequence = tgetstr (cap2, address); \
if (sequence) \
Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \
- Fmake_vector (make_fixnum (1), \
- intern (sym))); \
+ make_vector (1, intern (sym))); \
}
/* if there's no key_next keycap, map key_npage to `next' keysym */
tem = make_uninit_vector (n_windows);
data->saved_windows = tem;
for (i = 0; i < n_windows; i++)
- ASET (tem, i,
- Fmake_vector (make_fixnum (VECSIZE (struct saved_window)), Qnil));
+ ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
XSETWINDOW_CONFIGURATION (tem, data);
return (tem);
Vwith_echo_area_save_vector = Qnil;
if (NILP (vector))
- vector = Fmake_vector (make_fixnum (11), Qnil);
+ vector = make_nil_vector (11);
XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i;
ASET (vector, i, Vdeactivate_mark); ++i;
Vmode_line_unwind_vector = Qnil;
if (NILP (vector))
- vector = Fmake_vector (make_fixnum (10), Qnil);
+ vector = make_nil_vector (10);
ASET (vector, 0, make_fixnum (mode_line_target));
ASET (vector, 1, make_fixnum (MODE_LINE_NOPROP_LEN (0)));
/* Add a global definition if there is none. */
if (NILP (global_lface))
{
- global_lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
- Qunspecified);
+ global_lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
ASET (global_lface, 0, Qface);
Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
Vface_new_frame_defaults);
{
if (NILP (lface))
{
- lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
- Qunspecified);
+ lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
ASET (lface, 0, Qface);
fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist));
}
doc: /* Return a vector of face attributes corresponding to PLIST. */)
(Lisp_Object plist)
{
- Lisp_Object lface;
- lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
- Qunspecified);
+ Lisp_Object lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
merge_face_ref (NULL, XFRAME (selected_frame),
plist, XVECTOR (lface)->contents,
true, 0);
struct x_display_info *dpyinfo,
const char *source)
{
- Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+ Lisp_Object monitor_frames = make_nil_vector (n_monitors);
Lisp_Object frame, rest;
FOR_EACH_FRAME (rest, frame)
#endif
n_monitors = gdk_screen_get_n_monitors (gscreen);
#endif
- monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+ monitor_frames = make_nil_vector (n_monitors);
monitors = xzalloc (n_monitors * sizeof *monitors);
FOR_EACH_FRAME (rest, frame)
staticpro (&xfont_scripts_cache);
xfont_scripts_cache = CALLN (Fmake_hash_table, QCtest, Qequal);
staticpro (&xfont_scratch_props);
- xfont_scratch_props = Fmake_vector (make_fixnum (8), Qnil);
+ xfont_scratch_props = make_nil_vector (8);
register_font_driver (&xfont_driver, NULL);
}
data = (unsigned char *) idata;
}
- vec = Fmake_vector (make_fixnum (4), Qnil);
+ vec = make_nil_vector (4);
ASET (vec, 0, SYMBOL_NAME (x_atom_to_symbol (FRAME_DISPLAY_INFO (f),
event->message_type)));
ASET (vec, 1, frame);
{
Lisp_Object cbs = xw->script_callbacks;
if (NILP (cbs))
- xw->script_callbacks = cbs = Fmake_vector (make_fixnum (32), Qnil);
+ xw->script_callbacks = cbs = make_nil_vector (32);
/* Find first free index. */
ptrdiff_t idx;