{
nbytes = XINT (length);
val = make_uninit_string (nbytes);
- memset (SDATA (val), c, nbytes);
- SDATA (val)[nbytes] = 0;
+ if (nbytes)
+ {
+ memset (SDATA (val), c, nbytes);
+ SDATA (val)[nbytes] = 0;
+ }
}
else
{
memcpy (p, beg, len);
}
}
- *p = 0;
+ if (nbytes)
+ *p = 0;
}
return val;
if (min ((nbytes_max - header_size) / word_size, MOST_POSITIVE_FIXNUM) < len)
memory_full (SIZE_MAX);
v = allocate_vectorlike (len);
- v->header.size = len;
+ if (len)
+ v->header.size = len;
return v;
}
do { \
Lisp_Object tmp = XCAR (x); \
CHECK_CHARACTER (tmp); \
- XSETCAR ((x), tmp); \
} while (false)
#define CHECK_CHARACTER_CDR(x) \
do { \
Lisp_Object tmp = XCDR (x); \
CHECK_CHARACTER (tmp); \
- XSETCDR ((x), tmp); \
} while (false)
/* Nonzero iff C is a character of code less than 0x100. */
/* Mark STR as a unibyte string. */
#define STRING_SET_UNIBYTE(STR) \
do { \
- if (EQ (STR, empty_multibyte_string)) \
+ if (XSTRING (STR)->size == 0) \
(STR) = empty_unibyte_string; \
else \
XSTRING (STR)->size_byte = -1; \
ASCII characters in advance. */
#define STRING_SET_MULTIBYTE(STR) \
do { \
- if (EQ (STR, empty_unibyte_string)) \
+ if (XSTRING (STR)->size == 0) \
(STR) = empty_multibyte_string; \
else \
XSTRING (STR)->size_byte = XSTRING (STR)->size; \