Commit graph

10 commits

Author SHA1 Message Date
Julian Offenhäuser
463ab21305 LibC: Add strcasestr()
strcasestr() behaves exactly like strstr(), except it ignores case for
both inputs. This function is a nonstandard extension.
2023-02-08 19:06:42 +00:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Brian Gianforcaro
01bd3c5563 LibC: Expose AK::timing_safe_compare via timingsafe_memcmp(..)
Ports / other userland often needs such an implementation to function.
Lets expose `AK::timing_safe_compare` under the same name used used in
OpenBSD / FreeBSD / Solaris and other projects.
2022-03-13 19:08:58 -07:00
Linus Groh
471b798eb0 LibC: Implement strsep() 2022-01-10 23:47:30 +01:00
Jesse Buhagiar
eefad5ccd7 LibC: Include strings.h in string.h
Certain C Libraries have (unfortunately) included strings.h as a
part of string.h, which violates the POSIX spec for that specific
header. Some applications rely on this being the case, so let's
include it in our string.h
2022-01-04 07:27:04 +00:00
Brian Gianforcaro
fb8df01036 LibC: Add rindex() and index() APIs
These POSIX APIs are defined as mapping directly to
`strrchr` and `strchr` respectively.

These are needed for the latest version of the stress-ng port,
and also give us better POSIX compliance.
2021-12-28 11:00:51 +01:00
Tim Schumacher
dfc682dc40 LibC: Remove deprecation warnings from "unsafe" string functions
We have close to zero usages of the C string functions in our codebase
(including the "safe" alternatives), so the deprecation warnings are
unlikely to have an actual effect on preventing large-scale use of the
"unsafe" functions.

Meanwhile, the deprecation warnings are causing issues for ports that
are compiled using -Werror by default, and are generally a large source
for logspam when compiling.
2021-12-21 19:42:49 -08:00
Gunnar Beutner
c81b3e1ee3 LibC: Implement strerror_r()
This implements the XSI-compliant version of strerror_r() - as opposed
to the GNU-specific variant.

The function explicitly saves errno so as to not accidentally change it
with one of the calls to other functions.
2021-05-25 17:36:02 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibC/string.h (Browse further)