On 01/21/2017 09:57 AM, Yann Ylavic wrote: > Hi, > > On Sat, Jan 21, 2017 at 7:40 AM, <jaillet...@apache.org> wrote: >> Author: jailletc36 >> Date: Sat Jan 21 06:40:23 2017 >> New Revision: 1779700 >> >> URL: http://svn.apache.org/viewvc?rev=1779700&view=rev >> Log: >> Save a few bytes and a few cycles. >> >> Modified: >> httpd/httpd/trunk/modules/filters/mod_brotli.c >> >> Modified: httpd/httpd/trunk/modules/filters/mod_brotli.c >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_brotli.c?rev=1779700&r1=1779699&r2=1779700&view=diff >> ============================================================================== >> --- httpd/httpd/trunk/modules/filters/mod_brotli.c (original) >> +++ httpd/httpd/trunk/modules/filters/mod_brotli.c Sat Jan 21 06:40:23 2017 >> @@ -443,9 +443,9 @@ static apr_status_t compress_filter(ap_f >> apr_size_t len = strlen(etag); >> >> if (len > 2 && etag[len - 1] == '"') { >> - etag = apr_pstrndup(r->pool, etag, len - 1); >> + etag = apr_pstrmemdup(r->pool, etag, len - 1); >> etag = apr_pstrcat(r->pool, etag, "-br\"", NULL); > > We could possibly save more bytes yet with something like: > etag = apr_psnprintf(r->pool, etag, "%.*s-br\"", > (int)(len - 1), etag);
Saves bytes, but costs cycles as apr_psnprintf requires much more cycles than the above. So IMHO I would stick with the above. Regards RĂ¼diger