summaryrefslogtreecommitdiff
path: root/strings
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-207-44/+44
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* apr_strings: Provide apr_memzero_explicit() in APR.Yann Ylavic2022-06-281-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is handy outside apu_crypto usage, don't require users to link to APU for the feature. This commit moves the apr_crypto_memzero() implementation to apr_strings under the apr_memzero_explicit() name, and replaces the calls to the former with the latter, and apr_crypto_memzero() now calls apr_memzero_explicit() directly. * include/apr_strings.h(): Declare apr_memzero_explicit(). * strings/apr_strings.c(): Implement apr_memzero_explicit() by moving/renaming the code from apu_crypto. * crypto/apr_crypto.c(apr_crypto_memzero): Fall back to apr_memzero_explicit(). * crypto/apr_crypto.c(crypto_clear): Use apr_memzero_explicit() instead of apr_crypto_memzero(). * crypto/apr_crypto_prng.c(cprng_cleanup, cprng_stream_bytes, apr_crypto_prng_reseed, cprng_bytes, apr_crypto_prng_rekey, apr_crypto_prng_after_fork): Use apr_memzero_explicit() instead of apr_crypto_memzero(). * crypto/apr_md4.c(MD4Transform): Use apr_memzero_explicit() instead of apr_crypto_memzero(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902323 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Follow up to r1897102: Yet better apr_cstr_casecmp[n]().Yann Ylavic2022-01-161-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | This ones have a shorter prologue and epilogue (-O2 still). Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fd0 <+0>: xor %edx,%edx 0x0000000000049fd2 <+2>: lea 0x3d567(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fd9 <+9>: nopl 0x0(%rax) 0x0000000000049fe0 <+16>: movzbl (%rsi,%rdx,1),%eax 0x0000000000049fe4 <+20>: movzbl (%r8,%rax,1),%ecx 0x0000000000049fe9 <+25>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fed <+29>: add $0x1,%rdx 0x0000000000049ff1 <+33>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff6 <+38>: sub %ecx,%eax 0x0000000000049ff8 <+40>: jne 0x49ffe <apr_cstr_casecmp+46> 0x0000000000049ffa <+42>: test %ecx,%ecx 0x0000000000049ffc <+44>: jne 0x49fe0 <apr_cstr_casecmp+16> 0x0000000000049ffe <+46>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897121 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Improve apr_cstr_casecmp() and apr_cstr_casecmpn() performances.Yann Ylavic2022-01-151-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new versions [1] compile to a shorter/faster assembly than the previous ones [2], no functionnal change. [1] apr_cstr_casecmp() after this commit: Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fc0 <+0>: movzbl (%rdi),%eax 0x0000000000049fc3 <+3>: movzbl (%rsi),%edx 0x0000000000049fc6 <+6>: lea 0x3d573(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fcd <+13>: movzbl (%r8,%rax,1),%eax 0x0000000000049fd2 <+18>: movzbl (%r8,%rdx,1),%ecx 0x0000000000049fd7 <+23>: cmp %ecx,%eax 0x0000000000049fd9 <+25>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049fdb <+27>: xor %edx,%edx 0x0000000000049fdd <+29>: jmp 0x49ffa <apr_cstr_casecmp+58> 0x0000000000049fdf <+31>: nop 0x0000000000049fe0 <+32>: add $0x1,%rdx 0x0000000000049fe4 <+36>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fe8 <+40>: movzbl (%rsi,%rdx,1),%ecx 0x0000000000049fec <+44>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff1 <+49>: movzbl (%r8,%rcx,1),%ecx 0x0000000000049ff6 <+54>: cmp %ecx,%eax 0x0000000000049ff8 <+56>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049ffa <+58>: test %eax,%eax 0x0000000000049ffc <+60>: jne 0x49fe0 <apr_cstr_casecmp+32> 0x0000000000049ffe <+62>: sub %ecx,%eax 0x000000000004a000 <+64>: ret End of assembler dump. [2] apr_cstr_casecmp() before this commit: Dump of assembler code for function apr_cstr_casecmp: 0x000000000004a000 <+0>: movzbl (%rdi),%eax 0x000000000004a003 <+3>: movzbl (%rsi),%edx 0x000000000004a006 <+6>: lea 0x3d533(%rip),%r8 # 0x87540 <ucharmap> 0x000000000004a00d <+13>: mov %rdi,%r9 0x000000000004a010 <+16>: mov %rax,%rcx 0x000000000004a013 <+19>: movswl (%r8,%rdx,2),%edx 0x000000000004a018 <+24>: movswl (%r8,%rax,2),%eax 0x000000000004a01d <+29>: sub %edx,%eax 0x000000000004a01f <+31>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a021 <+33>: mov $0x1,%edx 0x000000000004a026 <+38>: test %ecx,%ecx 0x000000000004a028 <+40>: je 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a02a <+42>: nopw 0x0(%rax,%rax,1) 0x000000000004a030 <+48>: movzbl (%r9,%rdx,1),%eax 0x000000000004a035 <+53>: movzbl (%rsi,%rdx,1),%ecx 0x000000000004a039 <+57>: add $0x1,%rdx 0x000000000004a03d <+61>: mov %rax,%rdi 0x000000000004a040 <+64>: movswl (%r8,%rcx,2),%ecx 0x000000000004a045 <+69>: movswl (%r8,%rax,2),%eax 0x000000000004a04a <+74>: sub %ecx,%eax 0x000000000004a04c <+76>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a04e <+78>: test %edi,%edi 0x000000000004a050 <+80>: jne 0x4a030 <apr_cstr_casecmp+48> 0x000000000004a052 <+82>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897102 13f79535-47bb-0310-9956-ffa450edef68
* More revert of r1887500.Yann Ylavic2021-03-111-15/+26
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887505 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887060: fix compilation on BEOS.Yann Ylavic2021-03-111-26/+15
| | | | | | | poffset is undefined there, by inspection (no BEOS at hand..). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887500 13f79535-47bb-0310-9956-ffa450edef68
* Revert non-test part of r1878354, the Coverity warning was aJoe Orton2020-06-011-4/+4
| | | | | | | false -ve and there was no functional change nor bug. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878365 13f79535-47bb-0310-9956-ffa450edef68
* * strings/apr_strings.c (apr_pstrcat): Only read from the initializedJoe Orton2020-06-011-4/+4
| | | | | | | | | | | part of saved_lengths array when nargs < MAX_SAVED_LENGTHS (fixing Coverity warning). * test/teststr.c: Add trivial testcases for apr_pstrcat (though this does not reproduce any problems from the bug). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878354 13f79535-47bb-0310-9956-ffa450edef68
* PR 62555: fix edge-case int overflow in apr_itoaNick Kew2018-07-231-8/+12
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1836519 13f79535-47bb-0310-9956-ffa450edef68
* Follow-up to r1726928: Add APR_DECLARE() to apr_cstr_*() functionsIvan Zhakov2016-10-281-30/+36
| | | | | | | declaration to fix Windows build. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1767019 13f79535-47bb-0310-9956-ffa450edef68
* Upon closer scrutiny, the optimization of using short variablesWilliam A. Rowe Jr2016-06-081-8/+12
| | | | | | | | | | | | | (as opposed to the array of shorts) really didn't hold up. Revert back to processing in 'int' amounts, persist in using short values in the character case folding table, which are more easily retrieved based on word alignment. Aligning and representing the table values as 'int' doesn't exhibit any additional benefit and wastes some DATA page space. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747461 13f79535-47bb-0310-9956-ffa450edef68
* Third optimization, use short type, which is the smallestWilliam A. Rowe Jr2016-06-081-8/+8
| | | | | | | | | | | | functional int which requires 1. no unsigned -> signed promotion, 2. fetches from a word aligned offset from the lookup table, 3. is easily promoted to int upon the function's return. This introduces a very small 2% speed improvement in several cases. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747460 13f79535-47bb-0310-9956-ffa450edef68
* Additional 17% speedup by deferring unused pointer incrementsWilliam A. Rowe Jr2016-06-081-4/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747425 13f79535-47bb-0310-9956-ffa450edef68
* 17% speedup by eliminating redundant eos testWilliam A. Rowe Jr2016-06-081-2/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747424 13f79535-47bb-0310-9956-ffa450edef68
* Introduce the subset of svn_cstring_ functions into APR as the apr_cstr_William A. Rowe Jr2016-01-271-0/+392
| | | | | | | | | | | | | | | | | | | | | | | | | | family of functions. Requires the introduction of APR_ERANGE. Solves apr_cstr_casecmp[n] for ASCII and EBCDIC and borrows from the work of jim, ylavic and wrowe, see r1715401 forwards in; http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?view=log&pathrev=1722194 More performance review is needed against different compilers, so went ahead and borrowed original svn implementation as a basis, and we can port whichever performance enhancements test out more efficiently. Proposing for APR 1.6.0 which is the thought behind the initial @since tags. These must be changed if not accepted for backport. Note that the svn_cstring_join function could not be implemented as-is due to the absence of svn's counted string functionality. It deserves an implementation if not already present, or should be removed before tagging or backporting. No whitespace/formatting cleanup on this pass in order to preserve as much of the svn attributions as possible. This can happen in a later pass to conform to APR's style conventions. While renaming the functions, declarations themsel git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1726928 13f79535-47bb-0310-9956-ffa450edef68
* Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to ↵Christophe Jaillet2015-10-241-1/+1
| | | | | | save a few cycles. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1710307 13f79535-47bb-0310-9956-ffa450edef68
* Fix indentChristophe Jaillet2015-06-031-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1683221 13f79535-47bb-0310-9956-ffa450edef68
* Fix NULL pointer dereference if out of memStefan Fritsch2014-05-101-0/+2
| | | | | | | | | | in strdup() fallback function PR: 56385 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1593680 13f79535-47bb-0310-9956-ffa450edef68
* fix some minor bugs and useless assignments so that clang scan-buildJeff Trawick2013-10-231-1/+0
| | | | | | | is a little quieter git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1534882 13f79535-47bb-0310-9956-ffa450edef68
* make sure d is initedJim Jagielski2013-10-171-2/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1533111 13f79535-47bb-0310-9956-ffa450edef68
* it should really handle src==NULL Jim Jagielski2013-10-171-6/+9
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1533104 13f79535-47bb-0310-9956-ffa450edef68
* Fix flag character '#' in combination with formatRainer Jung2011-07-291-2/+2
| | | | | | | character 'x' in apr snprintf implementations. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1152309 13f79535-47bb-0310-9956-ffa450edef68
* Fix t ~= [/-/t] mismatch, observed by jorton.William A. Rowe Jr2011-05-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1124997 13f79535-47bb-0310-9956-ffa450edef68
* Fix PR 51219, /foo against /foo/bar.William A. Rowe Jr2011-05-181-3/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1124326 13f79535-47bb-0310-9956-ffa450edef68
* r1098292 appears to have failed to copy line-endingsWilliam A. Rowe Jr2011-05-141-478/+478
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103115 13f79535-47bb-0310-9956-ffa450edef68
* Further expression simplification for legibility.William A. Rowe Jr2011-05-141-9/+16
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103091 13f79535-47bb-0310-9956-ffa450edef68
* Fix syntax for legibility as suggested by Stefan.William A. Rowe Jr2011-05-141-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103070 13f79535-47bb-0310-9956-ffa450edef68
* CommentWilliam A. Rowe Jr2011-05-141-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103066 13f79535-47bb-0310-9956-ffa450edef68
* Refactor a complex test into a very simple test and William A. Rowe Jr2011-05-141-7/+14
| | | | | | | | | | optimize the exception cases to bust the loop early. Clean up documentation a bit. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103046 13f79535-47bb-0310-9956-ffa450edef68
* Fix another edge case, in [x-/] processing, which I can't seem William A. Rowe Jr2011-05-141-1/+1
| | | | | | | to compose the proper test-case to expose. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1103041 13f79535-47bb-0310-9956-ffa450edef68
* Optimize []...] pattern caseWilliam A. Rowe Jr2011-05-141-2/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1102995 13f79535-47bb-0310-9956-ffa450edef68
* Fix []...] pattern bug noted by jortonWilliam A. Rowe Jr2011-05-141-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1102992 13f79535-47bb-0310-9956-ffa450edef68
* Correct inlining per Jeff Trawick's feedback; Forward ports: r1098902William A. Rowe Jr2011-05-031-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1098904 13f79535-47bb-0310-9956-ffa450edef68
* Resolve issue identified by Jeff Trawick; '*?' was handledWilliam A. Rowe Jr2011-05-021-459/+460
| | | | | | | | | | correctly, while 'x?' was not. Resolves one alert, assignment within conditional expression, for pedantic compilers. Forward ports: r1098799 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1098805 13f79535-47bb-0310-9956-ffa450edef68
* Security: CVE-2011-0419William A. Rowe Jr2011-05-011-211/+377
| | | | | | | | | | | | | | | | | Reported by: Maksymilian Arciemowicz <cxib securityreason.com> Excessive CPU consumption was possible due to the unconstrained, recursive invocation of apr_fnmatch, as apr_fnmatch processed '*' wildcards. Introduce new apr_fnmatch implementation. This delivers optimizations in some common cases, without the underlying weakness of recursion present in older implementations. Submitted by: William Rowe Forward port: r1098289 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1098292 13f79535-47bb-0310-9956-ffa450edef68
* change apr_palloc+memcpy to apr_pmemdupJeff Trawick2011-04-061-2/+1
| | | | | | | | PR: 47776 Submitted by: Boya Sun <boya.sun case.edu> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1089438 13f79535-47bb-0310-9956-ffa450edef68
* quite warning...Jim Jagielski2011-01-191-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1060659 13f79535-47bb-0310-9956-ffa450edef68
* Fix cases where off_t (and APR_OFF_T_FMT) may be "larger" thanJim Jagielski2011-01-171-3/+20
| | | | | | | int64 (and APR_INT64_T_FMT). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1060104 13f79535-47bb-0310-9956-ffa450edef68
* * Similar to apr_strtoff reset errno to zero in apr_strtoi64.Ruediger Pluem2008-12-161-0/+2
| | | | | | | | Cases were observed where apr_strtoi64 returned with a previously set errno although the operation worked fine. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@727052 13f79535-47bb-0310-9956-ffa450edef68
* Fix apr_tokenize_to_argv parsing.Bojan Smojver2008-11-101-2/+1
| | | | | | | PR 46128. Patch by Edward Rudd <eddie omegaware.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@712627 13f79535-47bb-0310-9956-ffa450edef68
* Silence GCC 4.3 warning (patch by jorton).Bojan Smojver2008-05-271-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@660373 13f79535-47bb-0310-9956-ffa450edef68
* Document cvt from V7, not GNU libc, and copyrightJim Jagielski2008-05-021-2/+2
| | | | | | | Caldera International Inc. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@652832 13f79535-47bb-0310-9956-ffa450edef68
* * Fix compiler warning for uninitialized variableRuediger Pluem2008-02-231-1/+1
| | | | | | | | Spotted by: Sebastian Gottschalk <seppig_relay gmx.de> Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@630528 13f79535-47bb-0310-9956-ffa450edef68
* Introduce macro definitions of the min/max characteristics of the apr integerDavi Arnaut2007-07-091-4/+4
| | | | | | | types. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@554692 13f79535-47bb-0310-9956-ffa450edef68
* Convert wide* types to the portable apr types. Conversion table:Davi Arnaut2007-07-061-65/+50
| | | | | | | | | | | | | wide_int apr_int32_t u_wide_int apr_uint32_t widest_int apr_int64_t u_widest_int apr_uint64_t bool_int int Passes testfmt. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@553679 13f79535-47bb-0310-9956-ffa450edef68
* Binary size apr_vformatter as bytes, K, M, T, etc, to a four character compactedDavi Arnaut2007-06-291-0/+26
| | | | | | | human readable form. Based upon apr_strfsize. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@551923 13f79535-47bb-0310-9956-ffa450edef68
* Early assignment of the to-be-converted number yields better code and avoidsDavi Arnaut2007-06-291-11/+3
| | | | | | | ugly casts. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@551922 13f79535-47bb-0310-9956-ffa450edef68
* APR_VOID_P_IS_QUAD is not defined anywhere and the usual way isWilliam A. Rowe Jr2007-05-311-1/+1
| | | | | | | | | | using APR_SIZEOF_VOIDP. PR: 40758 Submitted by: Davi Arnaut <davi@haxent.com.br> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@543274 13f79535-47bb-0310-9956-ffa450edef68
* * strings/apr_snprintf.c (conv_10_quad): Fix formatting of unsignedJoe Orton2007-04-261-1/+1
| | | | | | | | | | | | | integers between 2^63 and 2^64 on 32-bit platforms. * test/testfmt.c (more_int64_fmts): Test an even bigger unsigned int64. Submitted by: Wynn Wilkes <wynn bungeelabs.com> PR: 42250 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@532733 13f79535-47bb-0310-9956-ffa450edef68
* If *pattern == '\\', and it does since that's the case we're in,Ken Coar2006-10-081-1/+1
| | | | | | | | | | then (*pattern++ == '\0') will always fail. Need to advance the pointer *before* the comparison. Reviewed: jerenkrantz git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@454200 13f79535-47bb-0310-9956-ffa450edef68