From 4f2cdd070c96d8d8fce15bb516856ee14a036891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sat, 30 Nov 2013 18:38:55 +0100 Subject: [PATCH] pcre: pcre_config returns a long for some parameters and int otherwise --- extra/pcre/pcre.factor | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/extra/pcre/pcre.factor b/extra/pcre/pcre.factor index 25707a07aa..bfd16ce835 100644 --- a/extra/pcre/pcre.factor +++ b/extra/pcre/pcre.factor @@ -33,13 +33,24 @@ ERROR: pcre-error value ; utf8-start-byte? [ nip ] [ next-utf8-char ] if ] [ 2drop f ] if* ; -: pcre-config ( what -- value ) - [ { long } [ pcre_config ] with-out-parameters ] keep +: check-bad-option ( err value what -- value ) rot 0 = [ drop ] [ bad-option ] if ; +: pcre-config ( what -- value ) + [ + dup { + PCRE_CONFIG_MATCH_LIMIT + PCRE_CONFIG_MATCH_LIMIT_RECURSION + } member? [ + { long } [ pcre_config ] with-out-parameters + ] [ + { int } [ pcre_config ] with-out-parameters + ] if + ] keep check-bad-option ; + : pcre-fullinfo ( pcre extra what -- obj ) [ { int } [ pcre_fullinfo ] with-out-parameters ] keep - rot 0 = [ drop ] [ bad-option ] if ; + check-bad-option ; : pcre-substring-list ( subject match-array count -- alien ) { void* } [ pcre_get_substring_list drop ] with-out-parameters ;