From 720359e08f943b74d9e08534d5f88e9585d0d421 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Fri, 3 Jan 2025 17:32:08 +0100 Subject: [PATCH] Use private interface for PL_get_int64_ex() internally. --- src/pl-error.c | 14 ++++++++------ src/pl-error.h | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pl-error.c b/src/pl-error.c index d2c4edd849..c4c4319a10 100644 --- a/src/pl-error.c +++ b/src/pl-error.c @@ -1068,12 +1068,9 @@ API_STUB(bool) ) bool -PL_get_int64_ex(term_t t, int64_t *i) -{ GET_LD - valid_term_t(t); - - if ( PL_get_int64(t, i) ) - succeed; +PL_get_int64_ex(DECL_LD term_t t, int64_t *i) +{ if ( PL_get_int64(t, i) ) + return true; if ( PL_is_integer(t) ) return PL_error(NULL, 0, NULL, ERR_REPRESENTATION, ATOM_int64_t); @@ -1081,6 +1078,11 @@ PL_get_int64_ex(term_t t, int64_t *i) return PL_error(NULL, 0, NULL, ERR_TYPE, ATOM_integer, t); } +API_STUB(bool) +(PL_get_int64_ex)(term_t t, int64_t *i) +( valid_term_t(t); + return PL_get_int64_ex(t, i); +) bool PL_get_intptr_ex(DECL_LD term_t t, intptr_t *i) diff --git a/src/pl-error.h b/src/pl-error.h index 57b157573b..ecdd1c6bb4 100644 --- a/src/pl-error.h +++ b/src/pl-error.h @@ -3,7 +3,7 @@ Author: Jan Wielemaker E-mail: J.Wielemaker@vu.nl WWW: http://www.swi-prolog.org - Copyright (c) 1997-2024, University of Amsterdam + Copyright (c) 1997-2025, University of Amsterdam CWI, Amsterdam SWI-Prolog Solutions b.v. All rights reserved. @@ -108,6 +108,7 @@ typedef enum #define PL_get_atom_ex(t, a) LDFUNC(PL_get_atom_ex, t, a) #define PL_get_size_ex(t, i) LDFUNC(PL_get_size_ex, t, i) #define pl_get_uint64(t, i, ex) LDFUNC(pl_get_uint64, t, i, ex) +#define PL_get_int64_ex(t, i) LDFUNC(PL_get_int64_ex, t, i) #define PL_get_uint64_ex(t, i) LDFUNC(PL_get_uint64_ex, t, i) #define PL_get_long_ex(t, i) LDFUNC(PL_get_long_ex, t, i) #define PL_get_intptr_ex(t, i) LDFUNC(PL_get_intptr_ex, t, i) @@ -123,6 +124,7 @@ bool printMessagev(atom_t severity, va_list args) WUNUSED; bool PL_get_atom_ex(term_t t, atom_t *a) WUNUSED; bool PL_get_size_ex(term_t t, size_t *i) WUNUSED; bool pl_get_uint64(term_t t, uint64_t *i, int ex) WUNUSED; +bool PL_get_int64_ex(term_t t, int64_t *i) WUNUSED; bool PL_get_uint64_ex(term_t t, uint64_t *i) WUNUSED; bool PL_get_module_ex(term_t name, module_t *m) WUNUSED; bool PL_get_arg_ex(size_t n, term_t term, term_t arg) WUNUSED;