summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-06-21 08:43:47 +0200
committerAndy Wingo <wingo@pobox.com>2018-06-21 20:20:01 +0200
commit6ad1fc9ce067b912892dd82c944d3870205301bd (patch)
tree2953b71490c3f431bc3f36c1349b70039ea5d222
parent16879cabed0e9bf218986bc886c3336a5f5a21c0 (diff)
downloadguile-6ad1fc9ce067b912892dd82c944d3870205301bd.tar.gz
Use ptrdiff_t instead of scm_t_ptrdiff
* libguile/continuations.h: * libguile/control.c: * libguile/control.h: * libguile/dynstack.c: * libguile/dynstack.h: * libguile/eval.c: * libguile/foreign.c: * libguile/frames.h: * libguile/gen-scmconfig.c: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/loader.c: * libguile/numbers.h: * libguile/stacks.c: * libguile/throw.c: * libguile/vm-engine.c: * libguile/vm.c: * libguile/vm.h: Use ptrdiff_t from stddef.h.
-rw-r--r--libguile/continuations.h2
-rw-r--r--libguile/control.c6
-rw-r--r--libguile/control.h2
-rw-r--r--libguile/dynstack.c12
-rw-r--r--libguile/dynstack.h12
-rw-r--r--libguile/eval.c2
-rw-r--r--libguile/foreign.c4
-rw-r--r--libguile/frames.h4
-rw-r--r--libguile/gen-scmconfig.c2
-rw-r--r--libguile/gsubr.c2
-rw-r--r--libguile/gsubr.h2
-rw-r--r--libguile/loader.c2
-rw-r--r--libguile/numbers.h2
-rw-r--r--libguile/stacks.c8
-rw-r--r--libguile/throw.c2
-rw-r--r--libguile/vm-engine.c12
-rw-r--r--libguile/vm.c18
-rw-r--r--libguile/vm.h4
18 files changed, 49 insertions, 49 deletions
diff --git a/libguile/continuations.h b/libguile/continuations.h
index cc0671c95..a7bfa60be 100644
--- a/libguile/continuations.h
+++ b/libguile/continuations.h
@@ -59,7 +59,7 @@ typedef struct
into the live stack, you need to add OFFSET so that it points
into the copy.
*/
- scm_t_ptrdiff offset;
+ ptrdiff_t offset;
SCM_STACKITEM stack[1]; /* copied stack of size num_stack_items. */
} scm_t_contregs;
diff --git a/libguile/control.c b/libguile/control.c
index 89b6f20cf..bd12fb6ca 100644
--- a/libguile/control.c
+++ b/libguile/control.c
@@ -47,10 +47,10 @@
/* Only to be called if the setjmp returns 1 */
SCM
scm_i_prompt_pop_abort_args_x (struct scm_vm *vp,
- scm_t_ptrdiff saved_stack_depth)
+ ptrdiff_t saved_stack_depth)
{
size_t i, n;
- scm_t_ptrdiff stack_depth;
+ ptrdiff_t stack_depth;
SCM vals = SCM_EOL;
stack_depth = vp->stack_top - vp->sp;
@@ -137,7 +137,7 @@ scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
scm_t_dynstack *dynstack = &SCM_I_CURRENT_THREAD->dynstack;
scm_t_bits *prompt;
scm_t_dynstack_prompt_flags flags;
- scm_t_ptrdiff fp_offset, sp_offset;
+ ptrdiff_t fp_offset, sp_offset;
union scm_vm_stack_element *fp, *sp;
uint32_t *ip;
jmp_buf *registers;
diff --git a/libguile/control.h b/libguile/control.h
index e86548a36..1b4065661 100644
--- a/libguile/control.h
+++ b/libguile/control.h
@@ -26,7 +26,7 @@
SCM_INTERNAL SCM scm_i_prompt_pop_abort_args_x (struct scm_vm *vp,
- scm_t_ptrdiff saved_stack_depth);
+ ptrdiff_t saved_stack_depth);
SCM_INTERNAL void scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
jmp_buf *registers) SCM_NORETURN;
diff --git a/libguile/dynstack.c b/libguile/dynstack.c
index a3cc68f96..6a5d9c215 100644
--- a/libguile/dynstack.c
+++ b/libguile/dynstack.c
@@ -39,9 +39,9 @@
#define PROMPT_WORDS 5
#define PROMPT_KEY(top) (SCM_PACK ((top)[0]))
-#define PROMPT_FP(top) ((scm_t_ptrdiff) ((top)[1]))
+#define PROMPT_FP(top) ((ptrdiff_t) ((top)[1]))
#define SET_PROMPT_FP(top, fp) do { top[1] = (scm_t_bits)(fp); } while (0)
-#define PROMPT_SP(top) ((scm_t_ptrdiff) ((top)[2]))
+#define PROMPT_SP(top) ((ptrdiff_t) ((top)[2]))
#define SET_PROMPT_SP(top, sp) do { top[2] = (scm_t_bits)(sp); } while (0)
#define PROMPT_IP(top) ((uint32_t *) ((top)[3]))
#define PROMPT_JMPBUF(top) ((jmp_buf *) ((top)[4]))
@@ -195,7 +195,7 @@ void
scm_dynstack_push_prompt (scm_t_dynstack *dynstack,
scm_t_dynstack_prompt_flags flags,
SCM key,
- scm_t_ptrdiff fp_offset, scm_t_ptrdiff sp_offset,
+ ptrdiff_t fp_offset, ptrdiff_t sp_offset,
uint32_t *ip, jmp_buf *registers)
{
scm_t_bits *words;
@@ -293,7 +293,7 @@ scm_dynstack_capture (scm_t_dynstack *dynstack, scm_t_bits *item)
}
void
-scm_dynstack_relocate_prompts (scm_t_dynstack *dynstack, scm_t_ptrdiff base)
+scm_dynstack_relocate_prompts (scm_t_dynstack *dynstack, ptrdiff_t base)
{
scm_t_bits *walk;
@@ -498,7 +498,7 @@ scm_dynstack_unwind_fork (scm_t_dynstack *dynstack, scm_t_dynstack *branch)
scm_t_bits*
scm_dynstack_find_prompt (scm_t_dynstack *dynstack, SCM key,
scm_t_dynstack_prompt_flags *flags,
- scm_t_ptrdiff *fp_offset, scm_t_ptrdiff *sp_offset,
+ ptrdiff_t *fp_offset, ptrdiff_t *sp_offset,
uint32_t **ip, jmp_buf **registers)
{
scm_t_bits *walk;
@@ -579,7 +579,7 @@ scm_dynstack_find_old_fluid_value (scm_t_dynstack *dynstack, SCM fluid,
void
scm_dynstack_wind_prompt (scm_t_dynstack *dynstack, scm_t_bits *item,
- scm_t_ptrdiff base_fp_offset,
+ ptrdiff_t base_fp_offset,
jmp_buf *registers)
{
scm_t_bits tag = SCM_DYNSTACK_TAG (item);
diff --git a/libguile/dynstack.h b/libguile/dynstack.h
index 9f42067d9..6fc824aa7 100644
--- a/libguile/dynstack.h
+++ b/libguile/dynstack.h
@@ -158,8 +158,8 @@ SCM_INTERNAL void scm_dynstack_push_dynamic_state (scm_t_dynstack *, SCM,
SCM_INTERNAL void scm_dynstack_push_prompt (scm_t_dynstack *,
scm_t_dynstack_prompt_flags,
SCM key,
- scm_t_ptrdiff fp_offset,
- scm_t_ptrdiff sp_offset,
+ ptrdiff_t fp_offset,
+ ptrdiff_t sp_offset,
uint32_t *ip,
jmp_buf *registers);
SCM_INTERNAL void scm_dynstack_push_dynwind (scm_t_dynstack *,
@@ -198,8 +198,8 @@ SCM_INTERNAL void scm_dynstack_unwind_dynamic_state
SCM_INTERNAL scm_t_bits* scm_dynstack_find_prompt (scm_t_dynstack *, SCM,
scm_t_dynstack_prompt_flags *,
- scm_t_ptrdiff *,
- scm_t_ptrdiff *,
+ ptrdiff_t *,
+ ptrdiff_t *,
uint32_t **,
jmp_buf **);
@@ -207,10 +207,10 @@ SCM_INTERNAL SCM scm_dynstack_find_old_fluid_value (scm_t_dynstack *,
SCM, size_t, SCM);
SCM_INTERNAL void scm_dynstack_relocate_prompts (scm_t_dynstack *,
- scm_t_ptrdiff);
+ ptrdiff_t);
SCM_INTERNAL void scm_dynstack_wind_prompt (scm_t_dynstack *, scm_t_bits *,
- scm_t_ptrdiff, jmp_buf *);
+ ptrdiff_t, jmp_buf *);
#endif /* SCM_DYNSTACK_H */
diff --git a/libguile/eval.c b/libguile/eval.c
index fe9240cf0..b663d7f84 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -435,7 +435,7 @@ eval (SCM x, SCM env)
SCM k, handler, res;
jmp_buf registers;
const void *prev_cookie;
- scm_t_ptrdiff saved_stack_depth;
+ ptrdiff_t saved_stack_depth;
k = EVAL1 (CAR (mx), env);
handler = EVAL1 (CDDR (mx), env);
diff --git a/libguile/foreign.c b/libguile/foreign.c
index 4d3f8764f..431fda811 100644
--- a/libguile/foreign.c
+++ b/libguile/foreign.c
@@ -1029,7 +1029,7 @@ scm_i_foreign_call (SCM cif_scm, SCM pointer_scm, int *errno_ret,
void **args;
unsigned i;
size_t arg_size;
- scm_t_ptrdiff off;
+ ptrdiff_t off;
cif = SCM_POINTER_VALUE (cif_scm);
func = SCM_POINTER_VALUE (pointer_scm);
@@ -1270,7 +1270,7 @@ scm_init_foreign (void)
#elif SCM_SIZEOF_SCM_T_PTRDIFF == 4
scm_from_uint8 (SCM_FOREIGN_TYPE_INT32)
#else
-# error unsupported sizeof (scm_t_ptrdiff)
+# error unsupported sizeof (ptrdiff_t)
#endif
);
diff --git a/libguile/frames.h b/libguile/frames.h
index 48e00e394..bbc47d009 100644
--- a/libguile/frames.h
+++ b/libguile/frames.h
@@ -120,8 +120,8 @@ union scm_vm_stack_element
struct scm_frame
{
void *stack_holder;
- scm_t_ptrdiff fp_offset;
- scm_t_ptrdiff sp_offset;
+ ptrdiff_t fp_offset;
+ ptrdiff_t sp_offset;
uint32_t *ip;
};
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 8091cc6dc..8eebe65bd 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -88,7 +88,7 @@
- make sure that anything that we explicitly typedef publically is
prefixed with scm_t_. i.e. we used to typedef long to ptrdiff_t
if we didn't detect ptrdiff_t, but this has been changed so that
- we typedef scm_t_ptrdiff instead so that we won't conflict with
+ we typedef ptrdiff_t instead so that we won't conflict with
any non-guile header definitions of the same type. For types
like intptr_t and uintptr_t which we just try to detect and don't
actually define, it's fine not to have a corresponding scm_t_
diff --git a/libguile/gsubr.c b/libguile/gsubr.c
index 01a51a1c3..bc12acfd9 100644
--- a/libguile/gsubr.c
+++ b/libguile/gsubr.c
@@ -298,7 +298,7 @@ scm_i_primitive_call_ip (SCM subr)
}
SCM
-scm_apply_subr (union scm_vm_stack_element *sp, scm_t_ptrdiff nslots)
+scm_apply_subr (union scm_vm_stack_element *sp, ptrdiff_t nslots)
{
SCM (*subr)() = SCM_SUBRF (sp[nslots - 1].as_scm);
diff --git a/libguile/gsubr.h b/libguile/gsubr.h
index 39a3eaaec..963bf4871 100644
--- a/libguile/gsubr.h
+++ b/libguile/gsubr.h
@@ -57,7 +57,7 @@ SCM_INTERNAL uintptr_t scm_i_primitive_call_ip (SCM subr);
union scm_vm_stack_element;
SCM_INTERNAL SCM scm_apply_subr (union scm_vm_stack_element *sp,
- scm_t_ptrdiff nargs);
+ ptrdiff_t nargs);
SCM_API SCM scm_c_make_gsubr (const char *name,
int req, int opt, int rst, scm_t_subr fcn);
diff --git a/libguile/loader.c b/libguile/loader.c
index 2a58dcaa1..b37721c52 100644
--- a/libguile/loader.c
+++ b/libguile/loader.c
@@ -264,7 +264,7 @@ process_dynamic_segment (char *base, Elf_Phdr *dyn_phdr,
Elf_Dyn *dyn = (Elf_Dyn *) dyn_addr;
size_t i, dyn_size = dyn_phdr->p_memsz / sizeof (Elf_Dyn);
char *init = 0, *gc_root = 0, *entry = 0, *frame_maps = 0;
- scm_t_ptrdiff gc_root_size = 0;
+ ptrdiff_t gc_root_size = 0;
enum bytecode_kind bytecode_kind = BYTECODE_KIND_NONE;
for (i = 0; i < dyn_size; i++)
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 121573a23..b472ab8cd 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -534,7 +534,7 @@ SCM_API SCM scm_from_mpz (mpz_t rop);
#define scm_to_ptrdiff_t scm_to_int64
#define scm_from_ptrdiff_t scm_from_int64
#else
-#error sizeof(scm_t_ptrdiff) is not 4 or 8.
+#error sizeof(ptrdiff_t) is not 4 or 8.
#endif
#endif
diff --git a/libguile/stacks.c b/libguile/stacks.c
index dcc8d2425..1332d1d9e 100644
--- a/libguile/stacks.c
+++ b/libguile/stacks.c
@@ -101,10 +101,10 @@ stack_depth (enum scm_vm_frame_kind kind, const struct scm_frame *frame)
* encountered.
*/
-static scm_t_ptrdiff
+static ptrdiff_t
find_prompt (SCM key)
{
- scm_t_ptrdiff fp_offset;
+ ptrdiff_t fp_offset;
if (!scm_dynstack_find_prompt (&SCM_I_CURRENT_THREAD->dynstack, key,
NULL, &fp_offset, NULL, NULL, NULL))
@@ -180,7 +180,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame,
else
{
/* Cut until the given prompt tag is seen. */
- scm_t_ptrdiff fp_offset = find_prompt (inner_cut);
+ ptrdiff_t fp_offset = find_prompt (inner_cut);
for (; len; len--, scm_c_frame_previous (kind, frame))
if (fp_offset == frame->fp_offset)
break;
@@ -240,7 +240,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame,
/* Cut until the given prompt tag is seen. */
long i;
struct scm_frame tmp;
- scm_t_ptrdiff fp_offset = find_prompt (outer_cut);
+ ptrdiff_t fp_offset = find_prompt (outer_cut);
memcpy (&tmp, frame, sizeof tmp);
diff --git a/libguile/throw.c b/libguile/throw.c
index 5fe235159..82a402541 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -87,7 +87,7 @@ catch (SCM tag, SCM thunk, SCM handler, SCM pre_unwind_handler)
scm_t_dynamic_state *dynamic_state = SCM_I_CURRENT_THREAD->dynamic_state;
jmp_buf registers;
const void *prev_cookie;
- scm_t_ptrdiff saved_stack_depth;
+ ptrdiff_t saved_stack_depth;
if (!scm_is_eq (tag, SCM_BOOL_T) && !scm_is_symbol (tag))
scm_wrong_type_arg ("catch", 1, tag);
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index a0938ea4c..0f79d1e0d 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -2685,14 +2685,14 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
{
uint8_t compare_result;
uint32_t expected;
- scm_t_ptrdiff nargs;
+ ptrdiff_t nargs;
UNPACK_24 (op, expected);
nargs = FRAME_LOCALS_COUNT ();
- if (nargs < (scm_t_ptrdiff) expected)
+ if (nargs < (ptrdiff_t) expected)
compare_result = SCM_F_COMPARE_LESS_THAN;
- else if (nargs == (scm_t_ptrdiff) expected)
+ else if (nargs == (ptrdiff_t) expected)
compare_result = SCM_F_COMPARE_EQUAL;
else
compare_result = SCM_F_COMPARE_NONE;
@@ -2706,7 +2706,7 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
{
uint8_t compare_result;
uint32_t nreq, expected;
- scm_t_ptrdiff nargs, npos;
+ ptrdiff_t nargs, npos;
UNPACK_24 (op, nreq);
UNPACK_24 (ip[1], expected);
@@ -2717,9 +2717,9 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
if (scm_is_keyword (FP_REF (npos)))
break;
- if (npos < (scm_t_ptrdiff) expected)
+ if (npos < (ptrdiff_t) expected)
compare_result = SCM_F_COMPARE_LESS_THAN;
- else if (npos == (scm_t_ptrdiff) expected)
+ else if (npos == (ptrdiff_t) expected)
compare_result = SCM_F_COMPARE_EQUAL;
else
compare_result = SCM_F_COMPARE_NONE;
diff --git a/libguile/vm.c b/libguile/vm.c
index 060300df7..434b3b51e 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -411,7 +411,7 @@ vm_reinstate_partial_continuation (struct scm_vm *vp, SCM cont, size_t nargs,
struct vm_reinstate_partial_continuation_data data;
struct scm_vm_cont *cp;
union scm_vm_stack_element *args;
- scm_t_ptrdiff old_fp_offset;
+ ptrdiff_t old_fp_offset;
args = alloca (nargs * sizeof (*args));
memcpy (args, vp->sp, nargs * sizeof (*args));
@@ -952,7 +952,7 @@ scm_i_vm_mark_stack (struct scm_vm *vp, struct GC_ms_entry *mark_stack_ptr,
fp < vp->stack_top;
fp = SCM_FRAME_DYNAMIC_LINK (fp))
{
- scm_t_ptrdiff nlocals = SCM_FRAME_NUM_LOCALS (fp, sp);
+ ptrdiff_t nlocals = SCM_FRAME_NUM_LOCALS (fp, sp);
size_t slot = nlocals - 1;
for (slot = nlocals - 1; sp < fp; sp++, slot--)
{
@@ -1018,7 +1018,7 @@ vm_expand_stack_inner (void *data_ptr)
struct scm_vm *vp = data->vp;
union scm_vm_stack_element *old_top, *new_bottom;
size_t new_size;
- scm_t_ptrdiff reloc;
+ ptrdiff_t reloc;
old_top = vp->stack_top;
new_size = vp->stack_size;
@@ -1042,7 +1042,7 @@ vm_expand_stack_inner (void *data_ptr)
return new_bottom;
}
-static scm_t_ptrdiff
+static ptrdiff_t
current_overflow_size (struct scm_vm *vp)
{
if (scm_is_pair (vp->overflow_handler_stack))
@@ -1051,9 +1051,9 @@ current_overflow_size (struct scm_vm *vp)
}
static int
-should_handle_stack_overflow (struct scm_vm *vp, scm_t_ptrdiff stack_size)
+should_handle_stack_overflow (struct scm_vm *vp, ptrdiff_t stack_size)
{
- scm_t_ptrdiff overflow_size = current_overflow_size (vp);
+ ptrdiff_t overflow_size = current_overflow_size (vp);
return overflow_size >= 0 && stack_size >= overflow_size;
}
@@ -1095,7 +1095,7 @@ unwind_overflow_handler (void *ptr)
static void
vm_expand_stack (struct scm_vm *vp, union scm_vm_stack_element *new_sp)
{
- scm_t_ptrdiff stack_size = vp->stack_top - new_sp;
+ ptrdiff_t stack_size = vp->stack_top - new_sp;
if (stack_size > vp->stack_size)
{
@@ -1181,7 +1181,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
greater than INTMAX/2 and therefore we don't have to check for
overflow here or below. */
size_t return_nlocals = 1, call_nlocals = nargs + 1, frame_size = 2;
- scm_t_ptrdiff stack_reserve_words;
+ ptrdiff_t stack_reserve_words;
size_t i;
thread = SCM_I_CURRENT_THREAD;
@@ -1424,7 +1424,7 @@ SCM_DEFINE (scm_call_with_stack_overflow_handler,
#define FUNC_NAME s_scm_call_with_stack_overflow_handler
{
struct scm_vm *vp;
- scm_t_ptrdiff c_limit, stack_size;
+ ptrdiff_t c_limit, stack_size;
struct overflow_handler_data data;
SCM new_limit, ret;
diff --git a/libguile/vm.h b/libguile/vm.h
index 14bc6660b..0d8cb8688 100644
--- a/libguile/vm.h
+++ b/libguile/vm.h
@@ -93,10 +93,10 @@ struct scm_vm_cont {
/* IP of newest frame. */
uint32_t *ra;
/* Offset of FP of newest frame, relative to stack top. */
- scm_t_ptrdiff fp_offset;
+ ptrdiff_t fp_offset;
/* Besides being the stack size, this is also the offset of the SP of
the newest frame. */
- scm_t_ptrdiff stack_size;
+ ptrdiff_t stack_size;
/* Stack bottom, which also keeps saved stack alive for GC. */
union scm_vm_stack_element *stack_bottom;
/* Saved dynamic stack, with prompts relocated to record saved SP/FP