1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-01 23:30:28 +02:00

Convert regexps to use statically-allocated tc16

* libguile/scm.h: Allocate tc16.
* libguile/regex-posix.h:
* libguile/regex-posix.c:
* libguile/finalizers.h:
* libguile/finalizers.c: Adapt.
This commit is contained in:
Andy Wingo 2025-06-17 14:35:51 +02:00
parent 197345fa02
commit ace42e191e
5 changed files with 68 additions and 38 deletions

View file

@ -43,6 +43,9 @@
#include "init.h"
#include "numbers.h"
#include "ports.h"
#ifdef ENABLE_REGEX
#include "regex-posix.h"
#endif
#include "smob.h"
#include "struct.h"
#include "symbols.h"
@ -78,6 +81,7 @@ enum builtin_finalizer_kind
FINALIZE_KIND_SMOB,
FINALIZE_KIND_PORT,
FINALIZE_KIND_DIRECTORY,
FINALIZE_KIND_REGEXP,
};
static SCM
@ -133,6 +137,12 @@ scm_i_add_directory_finalizer (struct scm_thread *thread, SCM obj)
return add_builtin_finalizer (thread, obj, FINALIZE_KIND_DIRECTORY);
}
SCM
scm_i_add_regexp_finalizer (struct scm_thread *thread, SCM obj)
{
return add_builtin_finalizer (thread, obj, FINALIZE_KIND_REGEXP);
}
SCM
scm_i_add_pointer_finalizer (struct scm_thread *thread, SCM obj, SCM free)
{
@ -184,6 +194,13 @@ run_finalizer (struct scm_thread *thread, SCM obj, SCM closure)
case FINALIZE_KIND_DIRECTORY:
scm_i_finalize_directory (thread, obj);
break;
case FINALIZE_KIND_REGEXP:
#ifdef ENABLE_REGEX
scm_i_finalize_regexp (thread, obj);
#else
abort ();
#endif
break;
default:
abort ();
}