Commit graph

15 commits

Author SHA1 Message Date
René Hickersberger
f2bd3904da LibC: Implement memccpy 2023-09-03 06:21:40 +02:00
Tim Schumacher
aae106e37b LibC: Add most of the "header may make visible" dependencies from POSIX 2023-07-19 00:19:35 -06:00
implicitfield
5dfe2eb389 Everywhere: Resolve conflicts with LibC and libc++
Since https://reviews.llvm.org/D131441, libc++ must be included before
LibC. As clang includes libc++ as one of the system includes, LibC
must be included after those, and the only correct way to do that is
to install LibC's headers into the sysroot.

Targets that don't link with LibC yet require its headers for one
reason or another must add install_libc_headers as a dependency to
ensure that the correct headers have been (re)installed into the
sysroot.

LibC/stddef.h has been dropped since the built-in stddef.h receives
a higher include priority.

In addition, string.h and wchar.h must
define __CORRECT_ISO_CPP_STRING_H_PROTO and
_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS respectively in order to tell
libc++ to not try to define methods implemented by LibC.
2023-06-27 12:40:38 +02:00
Dominika Liberda
75307803a2 LibC: Implement stpcpy
For better code clarity, also reformatted how strcpy increments
pointers.
2023-06-11 08:47:15 +02:00
Emily Trau
04b06afd39 LibC: Fix memmem signature compliance 2023-06-05 06:55:54 +02:00
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)