return s;
}
+/* Signal an error of type `buffer-too-small'. */
+static void
+module_buffer_too_small (ptrdiff_t actual, ptrdiff_t required)
+{
+ xsignal2 (Qbuffer_too_small, INT_TO_INTEGER (actual),
+ INT_TO_INTEGER (required));
+}
+
\f
/* Convenience macros for non-local exit handling. */
{
ptrdiff_t actual = *len;
*len = required_buf_size;
- args_out_of_range_3 (INT_TO_INTEGER (actual),
- INT_TO_INTEGER (required_buf_size),
- INT_TO_INTEGER (PTRDIFF_MAX));
+ module_buffer_too_small (actual, required_buf_size);
}
*len = required_buf_size;
{
ptrdiff_t actual = *count;
*count = required;
- args_out_of_range_3 (INT_TO_INTEGER (actual),
- INT_TO_INTEGER (required),
- INT_TO_INTEGER (module_bignum_count_max));
- }
+ module_buffer_too_small (actual, required);
+ }
/* Set u = abs(x). See https://stackoverflow.com/a/17313717. */
if (0 < x)
u = (EMACS_UINT) x;
{
ptrdiff_t actual = *count;
*count = required;
- args_out_of_range_3 (INT_TO_INTEGER (actual), INT_TO_INTEGER (required),
- INT_TO_INTEGER (module_bignum_count_max));
+ module_buffer_too_small (actual, required);
}
size_t written;
mpz_export (magnitude, &written, order, size, endian, nails, *x);
Fput (Qinvalid_arity, Qerror_message,
build_string ("Invalid function arity"));
+ DEFSYM (Qbuffer_too_small, "buffer-too-small");
+ Fput (Qbuffer_too_small, Qerror_conditions,
+ list2 (Qbuffer_too_small, Qerror));
+ Fput (Qbuffer_too_small, Qerror_message,
+ build_unibyte_string ("Memory buffer too small"));
+
DEFSYM (Qmodule_function_p, "module-function-p");
DEFSYM (Qunicode_string_p, "unicode-string-p");