summaryrefslogtreecommitdiffstats
path: root/regex.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-07 06:14:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-07 06:14:05 -0700
commitca0bcafd671f24481441bb7e9b30293758fe032b (patch)
tree34e6cdf24b6ec5a3e89f0b85fb8eed69e8a7c62d /regex.h
parente1e8eedfd994463db4a3db048117c4bcd9aaf416 (diff)
downloadtxr-ca0bcafd671f24481441bb7e9b30293758fe032b.tar.gz
txr-ca0bcafd671f24481441bb7e9b30293758fe032b.tar.bz2
txr-ca0bcafd671f24481441bb7e9b30293758fe032b.zip
New --free-all option for freeing memory on exit.
Although we are garbage-collected, being able to clean up on shutdown is nevertheless useful for uncovering leaks. Leaks can occur, for instance, due to neglect to free out-of-heap satellite data from objects that are reclaimed by gc. This feature is long overdue. * arith.c, arith.h (arith_free_all): New function. * gc.c, gc.h (gc_free_all): New function. * lib.c (init): Remove program name parameter and redundant initialization of progname globl variable. * lib.h (progname): Superfluous declaration removed. This is already declared in txr.h. (init): Declaration updated. * regex.c (char_set_destroy): Do not check the static allocation flag here; just destroy the object. Do check for a null pointer, though. (char_set_cobj_destroy): This cobj destructor now checks the static flag of the char set object and avoids freeing it. Thus our char set singletons are left alone by gc, but our global freeing function takes care of them. (wide_cs): New static variable moved out of wide_display_char_p to static scope. (regex_free_all): New function. * regex.h (regex_free_all): Declared. * txr.c (progname): const qualifier and initializer removed. (main): Ensure progname is always dynamically allocated, even in the argv[0] == 0 case. Do not pass progname to init; it doesn't take that argument any more. (free_all): New static function. (txr_main): Implement --free-all option. * txr.h (progname): Declaration updated.
Diffstat (limited to 'regex.h')
-rw-r--r--regex.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/regex.h b/regex.h
index 75bad120..599e985e 100644
--- a/regex.h
+++ b/regex.h
@@ -42,3 +42,4 @@ val regsub(val regex, val repl, val str);
val read_until_match(val regex, val stream, val keep_match);
int wide_display_char_p(wchar_t ch);
void regex_init(void);
+void regex_free_all(void);