diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-06-25 06:51:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-06-25 06:51:40 -0700 |
commit | 7d0fc1b26a3b42189621723ba5169f2e09d0c5d8 (patch) | |
tree | 172695f0cae25a429a20c35982278a3203a41bbb | |
parent | af873831f7585fc0843341951703a8edbf2d95bb (diff) | |
download | txr-7d0fc1b26a3b42189621723ba5169f2e09d0c5d8.tar.gz txr-7d0fc1b26a3b42189621723ba5169f2e09d0c5d8.tar.bz2 txr-7d0fc1b26a3b42189621723ba5169f2e09d0c5d8.zip |
ftw: fix broken callback mechanism.
* ftw.c (max): New macro.
(ftw_callback): Allocate enough args for all five arguments.
This bug went undetected when this was developed. A more
recently added assertion in args.c caught this.
-rw-r--r-- | ftw.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -43,6 +43,8 @@ #include "sysif.h" #include "ftw.h" +#define max(a, b) ((a) > (b) ? (a) : (b)) + static val s_callback; static uw_frame_t *s_exit_point; @@ -66,7 +68,7 @@ static int ftw_callback(const char *c_path, const struct stat *c_sb, val base = num(fb->base); val result; - args_decl(args, ARGS_MIN); + args_decl(args, max(ARGS_MIN, 5)); args_add5(args, path, type, sb, level, base); result = generic_funcall(s_callback, args); c_result = if3(integerp(result), c_num(result), 0); |