diff options
| author | Philipp Stephani | 2018-09-21 21:56:25 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2018-09-21 21:56:56 +0200 |
| commit | ee3be3fdfa96d7d1a0740c8145a26d758c12a711 (patch) | |
| tree | 57fde5b97151c85fb75fc67ce612493e7613d800 /src | |
| parent | 9f10e1a0eef0dd5572a34a76617d50df0e3dd357 (diff) | |
| download | emacs-ee3be3fdfa96d7d1a0740c8145a26d758c12a711.tar.gz emacs-ee3be3fdfa96d7d1a0740c8145a26d758c12a711.zip | |
Use new function overflow_error in a few places
* src/emacs-module.c (module_make_global_ref, module_funcall)
(module_make_string, Fmodule_load):
* src/json.c (json_to_lisp): Use overflow_error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.c | 8 | ||||
| -rw-r--r-- | src/json.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 6155535f869..1ecba8603ff 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -304,7 +304,7 @@ module_make_global_ref (emacs_env *env, emacs_value ref) | |||
| 304 | Lisp_Object value = HASH_VALUE (h, i); | 304 | Lisp_Object value = HASH_VALUE (h, i); |
| 305 | EMACS_INT refcount = XFIXNAT (value) + 1; | 305 | EMACS_INT refcount = XFIXNAT (value) + 1; |
| 306 | if (MOST_POSITIVE_FIXNUM < refcount) | 306 | if (MOST_POSITIVE_FIXNUM < refcount) |
| 307 | xsignal0 (Qoverflow_error); | 307 | overflow_error (); |
| 308 | value = make_fixed_natnum (refcount); | 308 | value = make_fixed_natnum (refcount); |
| 309 | set_hash_value_slot (h, i, value); | 309 | set_hash_value_slot (h, i, value); |
| 310 | } | 310 | } |
| @@ -475,7 +475,7 @@ module_funcall (emacs_env *env, emacs_value fun, ptrdiff_t nargs, | |||
| 475 | USE_SAFE_ALLOCA; | 475 | USE_SAFE_ALLOCA; |
| 476 | ptrdiff_t nargs1; | 476 | ptrdiff_t nargs1; |
| 477 | if (INT_ADD_WRAPV (nargs, 1, &nargs1)) | 477 | if (INT_ADD_WRAPV (nargs, 1, &nargs1)) |
| 478 | xsignal0 (Qoverflow_error); | 478 | overflow_error (); |
| 479 | SAFE_ALLOCA_LISP (newargs, nargs1); | 479 | SAFE_ALLOCA_LISP (newargs, nargs1); |
| 480 | newargs[0] = value_to_lisp (fun); | 480 | newargs[0] = value_to_lisp (fun); |
| 481 | for (ptrdiff_t i = 0; i < nargs; i++) | 481 | for (ptrdiff_t i = 0; i < nargs; i++) |
| @@ -583,7 +583,7 @@ module_make_string (emacs_env *env, const char *str, ptrdiff_t length) | |||
| 583 | { | 583 | { |
| 584 | MODULE_FUNCTION_BEGIN (module_nil); | 584 | MODULE_FUNCTION_BEGIN (module_nil); |
| 585 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) | 585 | if (! (0 <= length && length <= STRING_BYTES_BOUND)) |
| 586 | xsignal0 (Qoverflow_error); | 586 | overflow_error (); |
| 587 | /* FIXME: AUTO_STRING_WITH_LEN requires STR to be null-terminated, | 587 | /* FIXME: AUTO_STRING_WITH_LEN requires STR to be null-terminated, |
| 588 | but we shouldn't require that. */ | 588 | but we shouldn't require that. */ |
| 589 | AUTO_STRING_WITH_LEN (lstr, str, length); | 589 | AUTO_STRING_WITH_LEN (lstr, str, length); |
| @@ -749,7 +749,7 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0, | |||
| 749 | if (r != 0) | 749 | if (r != 0) |
| 750 | { | 750 | { |
| 751 | if (FIXNUM_OVERFLOW_P (r)) | 751 | if (FIXNUM_OVERFLOW_P (r)) |
| 752 | xsignal0 (Qoverflow_error); | 752 | overflow_error (); |
| 753 | xsignal2 (Qmodule_init_failed, file, make_fixnum (r)); | 753 | xsignal2 (Qmodule_init_failed, file, make_fixnum (r)); |
| 754 | } | 754 | } |
| 755 | 755 | ||
diff --git a/src/json.c b/src/json.c index 8b365e3795c..17cc0965b12 100644 --- a/src/json.c +++ b/src/json.c | |||
| @@ -740,7 +740,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf) | |||
| 740 | xsignal0 (Qjson_object_too_deep); | 740 | xsignal0 (Qjson_object_too_deep); |
| 741 | size_t size = json_array_size (json); | 741 | size_t size = json_array_size (json); |
| 742 | if (FIXNUM_OVERFLOW_P (size)) | 742 | if (FIXNUM_OVERFLOW_P (size)) |
| 743 | xsignal0 (Qoverflow_error); | 743 | overflow_error (); |
| 744 | Lisp_Object result = Fmake_vector (make_fixed_natnum (size), Qunbound); | 744 | Lisp_Object result = Fmake_vector (make_fixed_natnum (size), Qunbound); |
| 745 | for (ptrdiff_t i = 0; i < size; ++i) | 745 | for (ptrdiff_t i = 0; i < size; ++i) |
| 746 | ASET (result, i, | 746 | ASET (result, i, |
| @@ -759,7 +759,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf) | |||
| 759 | { | 759 | { |
| 760 | size_t size = json_object_size (json); | 760 | size_t size = json_object_size (json); |
| 761 | if (FIXNUM_OVERFLOW_P (size)) | 761 | if (FIXNUM_OVERFLOW_P (size)) |
| 762 | xsignal0 (Qoverflow_error); | 762 | overflow_error (); |
| 763 | result = CALLN (Fmake_hash_table, QCtest, Qequal, QCsize, | 763 | result = CALLN (Fmake_hash_table, QCtest, Qequal, QCsize, |
| 764 | make_fixed_natnum (size)); | 764 | make_fixed_natnum (size)); |
| 765 | struct Lisp_Hash_Table *h = XHASH_TABLE (result); | 765 | struct Lisp_Hash_Table *h = XHASH_TABLE (result); |