aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mod-test/mod-test.c
diff options
context:
space:
mode:
authorPaul Eggert2015-11-20 12:17:55 -0800
committerPaul Eggert2015-11-20 12:18:17 -0800
commit39d13206f3b37261bf4a2ebadfc1103414f4fd3e (patch)
tree0248a224d618f1947819a3712ef1ba4861cb479f /modules/mod-test/mod-test.c
parent95f69f2c5999be4b9444861b6d4ae1bd3ab87f83 (diff)
downloademacs-39d13206f3b37261bf4a2ebadfc1103414f4fd3e.tar.gz
emacs-39d13206f3b37261bf4a2ebadfc1103414f4fd3e.zip
Fix module test to use ptrdiff_t nargs too
* modules/mod-test/mod-test.c (Fmod_test_return_t) (Fmod_test_sum, Fmod_test_signal, Fmod_test_throw) (Fmod_test_non_local_exit_funcall, Fmod_test_globref_make) (Fmod_test_string_a_to_b, Fmod_test_userptr_make) (Fmod_test_userptr_get, Fmod_test_vector_fill) (Fmod_test_vector_eq): Arg counts are ptrdiff_t, not int. (finalizer): Remove; no longer used.
Diffstat (limited to '')
-rw-r--r--modules/mod-test/mod-test.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/modules/mod-test/mod-test.c b/modules/mod-test/mod-test.c
index bae1967f533..44a14dc6fdd 100644
--- a/modules/mod-test/mod-test.c
+++ b/modules/mod-test/mod-test.c
@@ -26,7 +26,8 @@ int plugin_is_GPL_compatible;
26 26
27/* Always return symbol 't'. */ 27/* Always return symbol 't'. */
28static emacs_value 28static emacs_value
29Fmod_test_return_t (emacs_env *env, int nargs, emacs_value args[], void *data) 29Fmod_test_return_t (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
30 void *data)
30{ 31{
31 return env->intern (env, "t"); 32 return env->intern (env, "t");
32} 33}
@@ -39,7 +40,7 @@ sum (intmax_t a, intmax_t b)
39} 40}
40 41
41static emacs_value 42static emacs_value
42Fmod_test_sum (emacs_env *env, int nargs, emacs_value args[], void *data) 43Fmod_test_sum (emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data)
43{ 44{
44 intmax_t a = env->extract_integer (env, args[0]); 45 intmax_t a = env->extract_integer (env, args[0]);
45 intmax_t b = env->extract_integer (env, args[1]); 46 intmax_t b = env->extract_integer (env, args[1]);
@@ -52,7 +53,8 @@ Fmod_test_sum (emacs_env *env, int nargs, emacs_value args[], void *data)
52 53
53/* Signal '(error 56). */ 54/* Signal '(error 56). */
54static emacs_value 55static emacs_value
55Fmod_test_signal (emacs_env *env, int nargs, emacs_value args[], void *data) 56Fmod_test_signal (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
57 void *data)
56{ 58{
57 assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); 59 assert (env->non_local_exit_check (env) == emacs_funcall_exit_return);
58 env->non_local_exit_signal (env, env->intern (env, "error"), 60 env->non_local_exit_signal (env, env->intern (env, "error"),
@@ -63,7 +65,8 @@ Fmod_test_signal (emacs_env *env, int nargs, emacs_value args[], void *data)
63 65
64/* Throw '(tag 65). */ 66/* Throw '(tag 65). */
65static emacs_value 67static emacs_value
66Fmod_test_throw (emacs_env *env, int nargs, emacs_value args[], void *data) 68Fmod_test_throw (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
69 void *data)
67{ 70{
68 assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); 71 assert (env->non_local_exit_check (env) == emacs_funcall_exit_return);
69 env->non_local_exit_throw (env, env->intern (env, "tag"), 72 env->non_local_exit_throw (env, env->intern (env, "tag"),
@@ -75,8 +78,8 @@ Fmod_test_throw (emacs_env *env, int nargs, emacs_value args[], void *data)
75/* Call argument function, catch all non-local exists and return 78/* Call argument function, catch all non-local exists and return
76 either normal result or a list describing the non-local exit. */ 79 either normal result or a list describing the non-local exit. */
77static emacs_value 80static emacs_value
78Fmod_test_non_local_exit_funcall (emacs_env *env, int nargs, emacs_value args[], 81Fmod_test_non_local_exit_funcall (emacs_env *env, ptrdiff_t nargs,
79 void *data) 82 emacs_value args[], void *data)
80{ 83{
81 assert (nargs == 1); 84 assert (nargs == 1);
82 emacs_value result = env->funcall (env, args[0], 0, NULL); 85 emacs_value result = env->funcall (env, args[0], 0, NULL);
@@ -113,7 +116,7 @@ Fmod_test_non_local_exit_funcall (emacs_env *env, int nargs, emacs_value args[],
113 116
114/* Return a global referrence. */ 117/* Return a global referrence. */
115static emacs_value 118static emacs_value
116Fmod_test_globref_make (emacs_env *env, int nargs, emacs_value args[], 119Fmod_test_globref_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
117 void *data) 120 void *data)
118{ 121{
119 /* Make a big string and make it global. */ 122 /* Make a big string and make it global. */
@@ -130,7 +133,7 @@ Fmod_test_globref_make (emacs_env *env, int nargs, emacs_value args[],
130/* Return a copy of the argument string where every 'a' is replaced 133/* Return a copy of the argument string where every 'a' is replaced
131 with 'b'. */ 134 with 'b'. */
132static emacs_value 135static emacs_value
133Fmod_test_string_a_to_b (emacs_env *env, int nargs, emacs_value args[], 136Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
134 void *data) 137 void *data)
135{ 138{
136 emacs_value lisp_str = args[0]; 139 emacs_value lisp_str = args[0];
@@ -158,18 +161,10 @@ struct super_struct
158 char large_unused_buffer[512]; 161 char large_unused_buffer[512];
159}; 162};
160 163
161/* Associated finalizer. */
162static void
163finalizer (void *p)
164{
165 if (p)
166 free (p);
167}
168
169/* Return a new user-pointer to a super_struct, with amazing_int set 164/* Return a new user-pointer to a super_struct, with amazing_int set
170 to the passed parameter. */ 165 to the passed parameter. */
171static emacs_value 166static emacs_value
172Fmod_test_userptr_make (emacs_env *env, int nargs, emacs_value args[], 167Fmod_test_userptr_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
173 void *data) 168 void *data)
174{ 169{
175 struct super_struct *p = calloc (1, sizeof *p); 170 struct super_struct *p = calloc (1, sizeof *p);
@@ -179,7 +174,8 @@ Fmod_test_userptr_make (emacs_env *env, int nargs, emacs_value args[],
179 174
180/* Return the amazing_int of a passed 'user-pointer to a super_struct'. */ 175/* Return the amazing_int of a passed 'user-pointer to a super_struct'. */
181static emacs_value 176static emacs_value
182Fmod_test_userptr_get (emacs_env *env, int nargs, emacs_value args[], void *data) 177Fmod_test_userptr_get (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
178 void *data)
183{ 179{
184 struct super_struct *p = env->get_user_ptr (env, args[0]); 180 struct super_struct *p = env->get_user_ptr (env, args[0]);
185 return env->make_integer (env, p->amazing_int); 181 return env->make_integer (env, p->amazing_int);
@@ -188,7 +184,8 @@ Fmod_test_userptr_get (emacs_env *env, int nargs, emacs_value args[], void *data
188 184
189/* Fill vector in args[0] with value in args[1]. */ 185/* Fill vector in args[0] with value in args[1]. */
190static emacs_value 186static emacs_value
191Fmod_test_vector_fill (emacs_env *env, int nargs, emacs_value args[], void *data) 187Fmod_test_vector_fill (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
188 void *data)
192{ 189{
193 emacs_value vec = args[0]; 190 emacs_value vec = args[0];
194 emacs_value val = args[1]; 191 emacs_value val = args[1];
@@ -202,7 +199,8 @@ Fmod_test_vector_fill (emacs_env *env, int nargs, emacs_value args[], void *data
202/* Return whether all elements of vector in args[0] are 'eq' to value 199/* Return whether all elements of vector in args[0] are 'eq' to value
203 in args[1]. */ 200 in args[1]. */
204static emacs_value 201static emacs_value
205Fmod_test_vector_eq (emacs_env *env, int nargs, emacs_value args[], void *data) 202Fmod_test_vector_eq (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
203 void *data)
206{ 204{
207 emacs_value vec = args[0]; 205 emacs_value vec = args[0];
208 emacs_value val = args[1]; 206 emacs_value val = args[1];