Commit Graph

28 Commits

Author SHA1 Message Date
400c5e5c83 use restrict everywhere it's required by c99 and/or posix 2008
to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.
2012-09-06 22:44:55 -04:00
bac03cdde1 remove dependency of wmemmove on wmemcpy direction
unlike the memmove commit, this one should be fine to leave in place.
wmemmove is not performance-critical, and even if it were, it's
already copying whole 32-bit words at a time instead of bytes.
2012-09-06 20:28:42 -04:00
594318fd3d remove dependency of memmove on memcpy direction
this commit introduces a performance regression in many uses of
memmove, which will need to be addressed before the next release. i'm
making it as a temporary measure so that the restrict patch can be
committed without invoking undefined behavior when memmove calls
memcpy with overlapping regions.
2012-09-06 20:25:48 -04:00
aaa9eb5101 memcpy asm for i386 and x86_64 2012-08-11 21:33:13 -04:00
f997e224fc remove unused but buggy code from strstr.c 2012-08-11 18:40:33 -04:00
35c16933f0 remove buggy short-string wcsstr implementation; always use twoway
since this interface is rarely used, it's probably best to lean
towards keeping code size down anyway. one-character needles will
still be found immediately by the initial wcschr call anyway.
2012-08-11 18:39:12 -04:00
970ef6a124 optimize mempcpy to minimize need for data saved across the call 2012-07-31 21:18:17 -04:00
f313a16224 make strerror_r behave nicer on failure
if the buffer is too short, at least return a partial string. this is
helpful if the caller is lazy and does not check for failure. care is
taken to avoid writing anything if the buffer length is zero, and to
always null-terminate when the buffer length is non-zero.
2012-06-20 12:07:18 -04:00
054ba18599 fix overrun (n essentially ignored) in wcsncmp
bug report and solution by Richard Pennington
2012-05-26 18:04:17 -04:00
aefd0f69bd fix failure of strrchr(str, 0)
bug report and solution by Richard Pennington
2012-05-26 18:01:34 -04:00
e0614f7cd4 add all missing wchar functions except floating point parsers
these are mostly untested and adapted directly from corresponding byte
string functions and similar.
2012-03-01 23:24:45 -05:00
a6540174be add dummied strverscmp (obnoxious GNU function)
programs that use this tend to horribly botch international text
support, so it's questionable whether we want to support it even in
the long term... for now, it's just a dummy that calls strcmp.
2011-09-11 22:45:56 -04:00
73d2fde119 fix wrong type for wcsrchr argument 2 2011-06-13 14:06:04 -04:00
86339bc4ba fix strncat and wcsncat (double null termination)
also modify wcsncpy to use the same loop logic
2011-05-22 21:58:43 -04:00
e98136207a fix wcsncpy writing past end of buffer 2011-05-22 21:54:42 -04:00
b5b41212a6 function signature fix: add const qualifier to mempcpy src arg 2011-04-26 12:28:41 -04:00
6597f9ac13 implement memrchr (nonstandard) and optimize strrchr in terms of it 2011-04-13 08:36:29 -04:00
cb8dff2149 fix misplaced *'s in string functions (harmless) 2011-04-07 16:19:30 -04:00
1fee6186fe fix prototype for strsep 2011-04-06 14:28:29 -04:00
16675df793 fix misaligned read on early string termination in strchr
this could actually cause rare crashes in the case where a short
string is located at the end of a page and the following page is not
readable, and in fact this was seen in gcc compiling certain files.
2011-04-05 09:27:41 -04:00
c68b26369e fix serious bug in strchr - char signedness
search for bytes with high bit set was giving (potentially dangerous)
wrong results. i've tested, cleaned up, and hopefully sped up this
function now.
2011-04-03 18:16:11 -04:00
9ae8d5fc71 fix all implicit conversion between signed/unsigned pointers
sadly the C language does not specify any such implicit conversion, so
this is not a matter of just fixing warnings (as gcc treats it) but
actual errors. i would like to revisit a number of these changes and
possibly revise the types used to reduce the number of casts required.
2011-03-25 16:34:03 -04:00
a012aa879f fix broken wmemchr (unbounded search) 2011-03-17 22:38:45 -04:00
2a195dd31c fix missing prototype for strsignal 2011-02-26 23:50:26 -05:00
b8ff2aaabb add implementation of memccpy function 2011-02-24 12:35:42 -05:00
9f19b3ec8d fix backwards conditional in stpncpy
this only made the function unnecessarily slow on systems with
unaligned access, but would of course crash on systems that can't do
unaligned accesses (none of which have ports yet).
2011-02-24 12:34:31 -05:00
ca1aa5bae9 more header cleanup and conformance fixes - string.h 2011-02-14 20:53:15 -05:00
0b44a0315b initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00