Skip to content

Commit

Permalink
Use private interface for PL_get_int64_ex() internally.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Jan 3, 2025
1 parent f1fdd1c commit 720359e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/pl-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,19 +1068,21 @@ 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);

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)
Expand Down
4 changes: 3 additions & 1 deletion src/pl-error.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Author: Jan Wielemaker
E-mail: [email protected]
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.
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 720359e

Please sign in to comment.