Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Several PCRE module oddities



# schaefer@xxxxxxxxxxxxxxxx / 2014-07-19 15:21:16 -0700:
> -    if (offset_start < 0 || offset_start >= subject_len)
> +    if (offset_start < 0 ||
> +	(subject_len ? offset_start >= subject_len : offset_start > 0))
>  	ret = PCRE_ERROR_NOMATCH;
>      else
>  	ret = pcre_exec(pcre_pattern, pcre_hints, plaintext, subject_len, offset_start, 0, ovec, ovecsize);

maybe the slightly shorter version?

> -    if (offset_start < 0 || offset_start >= (subject_len ? subject_len : 1))

-- 
roman



Messages sorted by: Reverse Date, Date, Thread, Author