From c66668a87a062bc4ff7023adbc101793849021b5 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 30 Jun 2025 15:37:22 +0200 Subject: [PATCH] Move struct scm_regexp definition to internal header * libguile/regex-posix.c: * libguile/regex-posix.h (scm_is_regexp): (scm_to_regexp): (scm_from_regexp): (SCM_REGEXP_P): (SCM_VALIDATE_REGEXP): Move definitions to header. --- libguile/regex-posix.c | 30 ------------------------------ libguile/regex-posix.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c index 593ed97c5..98cee5315 100644 --- a/libguile/regex-posix.c +++ b/libguile/regex-posix.c @@ -61,36 +61,6 @@ #define REG_BASIC 0 #endif -struct scm_regexp -{ - scm_t_bits tag; - regex_t regex; -}; - -static inline int -scm_is_regexp (SCM x) -{ - return SCM_HAS_TYP16 (x, scm_tc16_regexp); -} - -static inline struct scm_regexp* -scm_to_regexp (SCM x) -{ - if (!scm_is_regexp (x)) - abort (); - return (struct scm_regexp *) SCM_UNPACK_POINTER (x); -} - -static inline SCM -scm_from_regexp (struct scm_regexp *x) -{ - return SCM_PACK_POINTER (x); -} - -#define SCM_REGEXP_P(x) (scm_is_regexp (x)) -#define SCM_VALIDATE_REGEXP(pos, a) \ - SCM_MAKE_VALIDATE_MSG (pos, a, REGEXP_P, "regexp") - void scm_i_finalize_regexp (struct scm_thread *thread, SCM obj) { diff --git a/libguile/regex-posix.h b/libguile/regex-posix.h index b0566e55f..93b3b0413 100644 --- a/libguile/regex-posix.h +++ b/libguile/regex-posix.h @@ -22,8 +22,40 @@ +#include + #include +struct scm_regexp +{ + scm_t_bits tag; + regex_t regex; +}; + +static inline int +scm_is_regexp (SCM x) +{ + return SCM_HAS_TYP16 (x, scm_tc16_regexp); +} + +static inline struct scm_regexp* +scm_to_regexp (SCM x) +{ + if (!scm_is_regexp (x)) + abort (); + return (struct scm_regexp *) SCM_UNPACK_POINTER (x); +} + +static inline SCM +scm_from_regexp (struct scm_regexp *x) +{ + return SCM_PACK_POINTER (x); +} + +#define SCM_REGEXP_P(x) (scm_is_regexp (x)) +#define SCM_VALIDATE_REGEXP(pos, a) \ + SCM_MAKE_VALIDATE_MSG (pos, a, REGEXP_P, "regexp") + SCM_INTERNAL void scm_i_finalize_regexp (struct scm_thread*, SCM); SCM_INTERNAL void scm_init_regex_posix (void);