httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe Jr." <wr...@rowe-clan.net>
Subject Re: Really big regex results from ap_pregsub
Date Thu, 13 Oct 2011 18:34:26 GMT
On 10/13/2011 9:36 AM, Jim Jagielski wrote:
> 
> I propose that if nmatch>AP_MAX_REG_MATCH, we return the orig
> string. From what I can tell, we've never returned NULL, unless
> the source itself was NULL, having our failure return the orig
> string seems safest.

I can't see how this is possible.  An error condition must be
triggered somehow, in the absence of giving the user a test to
determine if their ap_pregsub call would succeed.

This is certainly a fine example of bad API design; one would
expect most of us to author something accepting a char **result
arg and returning an apr_status_t.

But returning success for failure violates all API design.

The only other option at this late date might be a marked ""
string result.  Return \0\xba\xad\0 or similar; and give the
user an AP_PREGSUB_SUCCESS() test to inspect the result.  Of
course all normal null string results would have to be padded,
as well (\0\0 at least).


Mime
View raw message