Commit d9b300af authored by Paul Eggert's avatar Paul Eggert

Omit ‘const’ on locals

Remove ‘const’ qualifier from locals that were newly added.
We don’t normally bother declaring locals with ‘const’ even
though they are not modified, for the same reason we don’t
bother declaring them with ‘register’ even though their
addresses are not taken; the advantage in compile-time
checking isn’t worth the loss of readability.
* modules/mod-test/mod-test.c (Fmod_test_non_local_exit_funcall)
(Fmod_test_vector_fill, Fmod_test_vector_eq):
* src/emacs-module.c (MODULE_SETJMP_1)
(module_make_global_ref, module_free_global_ref)
(module_non_local_exit_get, module_make_function)
(module_extract_integer, module_extract_float)
(module_get_user_ptr, module_set_user_ptr)
(module_get_user_finalizer, module_set_user_finalizer)
(module_vec_get, Fmodule_call)
(module_non_local_exit_signal_1)
(module_non_local_exit_throw_1, lisp_to_value)
(finalize_storage, allocate_emacs_value, mark_modules)
(module_handle_signal, module_handle_throw)
(module_format_fun_env):
* src/eval.c (push_handler, push_handler_nosignal)
(init_handler):
* src/lread.c (suffix_p):
Omit unnecessary ‘const’.
parent 68d58e69
......@@ -78,7 +78,7 @@ Fmod_test_non_local_exit_funcall (emacs_env *env, int nargs, emacs_value args[],
void *data)
{
assert (nargs == 1);
const emacs_value result = env->funcall (env, args[0], 0, NULL);
emacs_value result = env->funcall (env, args[0], 0, NULL);
emacs_value non_local_exit_symbol, non_local_exit_data;
enum emacs_funcall_exit code
= env->non_local_exit_get (env, &non_local_exit_symbol,
......@@ -90,7 +90,7 @@ Fmod_test_non_local_exit_funcall (emacs_env *env, int nargs, emacs_value args[],
case emacs_funcall_exit_signal:
{
env->non_local_exit_clear (env);
const emacs_value Flist = env->intern (env, "list");
emacs_value Flist = env->intern (env, "list");
emacs_value list_args[] = {env->intern (env, "signal"),
non_local_exit_symbol, non_local_exit_data};
return env->funcall (env, Flist, 3, list_args);
......@@ -98,7 +98,7 @@ Fmod_test_non_local_exit_funcall (emacs_env *env, int nargs, emacs_value args[],
case emacs_funcall_exit_throw:
{
env->non_local_exit_clear (env);
const emacs_value Flist = env->intern (env, "list");
emacs_value Flist = env->intern (env, "list");
emacs_value list_args[] = {env->intern (env, "throw"),
non_local_exit_symbol, non_local_exit_data};
return env->funcall (env, Flist, 3, list_args);
......@@ -191,7 +191,7 @@ Fmod_test_vector_fill (emacs_env *env, int nargs, emacs_value args[], void *data
{
emacs_value vec = args[0];
emacs_value val = args[1];
const size_t size = env->vec_size (env, vec);
size_t size = env->vec_size (env, vec);
for (size_t i = 0; i < size; i++)
env->vec_set (env, vec, i, val);
return env->intern (env, "t");
......@@ -205,7 +205,7 @@ Fmod_test_vector_eq (emacs_env *env, int nargs, emacs_value args[], void *data)
{
emacs_value vec = args[0];
emacs_value val = args[1];
const size_t size = env->vec_size (env, vec);
size_t size = env->vec_size (env, vec);
for (size_t i = 0; i < size; i++)
if (!env->eq (env, env->vec_get (env, vec, i), val))
return env->intern (env, "nil");
......
This diff is collapsed.
......@@ -1399,8 +1399,9 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
static void init_handler (struct handler *c, Lisp_Object tag_ch_val,
enum handlertype handlertype);
void push_handler (struct handler **const c, const Lisp_Object tag_ch_val,
const enum handlertype handlertype)
void
push_handler (struct handler **c, Lisp_Object tag_ch_val,
enum handlertype handlertype)
{
if (handlerlist->nextfree)
*c = handlerlist->nextfree;
......@@ -1413,14 +1414,15 @@ void push_handler (struct handler **const c, const Lisp_Object tag_ch_val,
init_handler (*c, tag_ch_val, handlertype);
}
bool push_handler_nosignal (struct handler **const c, const Lisp_Object tag_ch_val,
const enum handlertype handlertype)
bool
push_handler_nosignal (struct handler **c, Lisp_Object tag_ch_val,
enum handlertype handlertype)
{
if (handlerlist->nextfree)
*c = handlerlist->nextfree;
else
{
struct handler *const h = malloc (sizeof (struct handler));
struct handler *h = malloc (sizeof (struct handler));
if (! h) return false;
*c = h;
h->nextfree = NULL;
......@@ -1430,8 +1432,9 @@ bool push_handler_nosignal (struct handler **const c, const Lisp_Object tag_ch_v
return true;
}
static void init_handler (struct handler *const c, const Lisp_Object tag_ch_val,
const enum handlertype handlertype)
static void
init_handler (struct handler *c, Lisp_Object tag_ch_val,
enum handlertype handlertype)
{
c->type = handlertype;
c->tag_or_ch = tag_ch_val;
......
......@@ -979,8 +979,8 @@ This uses the variables `load-suffixes' and `load-file-rep-suffixes'. */)
static bool
suffix_p (Lisp_Object string, const char *suffix)
{
const size_t suffix_len = strlen (suffix);
const size_t string_len = SBYTES (string);
size_t suffix_len = strlen (suffix);
size_t string_len = SBYTES (string);
return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - suffix_len, suffix);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment