summaryrefslogtreecommitdiffstats
path: root/otherlibs/str/strstubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/str/strstubs.c')
-rw-r--r--otherlibs/str/strstubs.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/otherlibs/str/strstubs.c b/otherlibs/str/strstubs.c
index caa03e423..1ff544122 100644
--- a/otherlibs/str/strstubs.c
+++ b/otherlibs/str/strstubs.c
@@ -7,11 +7,12 @@
#include <regex.h>
#include <mlvalues.h>
#include <alloc.h>
+#include <custom.h>
#include <fail.h>
#include <memory.h>
struct regexp_struct {
- final_fun finalization;
+ struct custom_operations * ops;
struct re_pattern_buffer re;
};
@@ -24,11 +25,19 @@ static void free_regexp(value vexpr)
regfree(&(expr->re));
}
+static struct custom_operations regexp_ops = {
+ "_regexp",
+ free_regexp,
+ custom_compare_default,
+ custom_hash_default,
+ custom_serialize_default,
+ custom_deserialize_default
+};
+
static regexp alloc_regexp(void)
{
value res =
- alloc_final(sizeof(struct regexp_struct) / sizeof(value),
- free_regexp, 1, 10000);
+ alloc_custom(&regexp_ops, sizeof(struct regexp_struct), 1, 10000);
return (regexp) res;
}