History log of /freebsd-current/include/string.h
Revision Date Author Comments
# 5a1d1441 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

include: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 05c9a015 24-Aug-2022 Aymeric Wibo <obiwac@gmail.com>

libc: Add strverscmp(3) and versionsort(3)

Add a strverscmp(3) function to libc, a GNU extension I implemented by
reading its glibc manual page. It orders strings following a much more
natural ordering (e.g. "ent1 < ent2 < ent10" as opposed to
"ent1 < ent10 < ent2" with strcmp(3)'s lexicographic ordering).

Also add versionsort(3) for use as scandir(3)'s compar argument.

Update manual page for scandir(3) and add one for strverscmp(3).

Reviewed by: pstef, gbe, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35807


# ee37f64c 14-Jul-2021 Konstantin Belousov <kib@FreeBSD.org>

libc: add mempcpy(3) and wmempcpy(3)

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31180


# 849dcdb1 25-Jun-2021 Alfonso Gregory <gfunni234@gmail.com>

Change strmode argument type to mode_t

Finally, we have the correct function definition for strmode. NetBSD/OpenBSD
did this many years ago. This code is weird sign extension safe.

Reviewed by: imp@
Pull Request: https://github.com/freebsd/freebsd-src/pull/493


# 65bf3043 17-Dec-2020 Konstantin Belousov <kib@FreeBSD.org>

Change POSIX compliance level for visibility of strerror_l(3).

Third-party code tests for strerror_l(3) without specifying
_POSIX_SOURCE, and then expects that the function is prototyped with
_POSIX_SOURCE set to 200112.

Reported and tested by: antoine
Sponsored by: The FreeBSD Foundation
MFC after: 13 days


# 11478453 20-Aug-2019 Dimitry Andric <dim@FreeBSD.org>

Vendor import of stripped libc++ trunk r366426 (just before the release_90 branch
point):

https://llvm.org/svn/llvm-project/libcxx/trunk@366426


# 2321c474 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

include: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 9851b340 29-Mar-2017 Konstantin Belousov <kib@FreeBSD.org>

Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.

Other needed supporting types, defines and constraint_handler
infrastructure is added as specified in the C11 spec.

Submitted by: Tom Rix <trix@juniper.net>
Sponsored by: Juniper Networks
Discussed with: ed
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D9903
Differential revision: https://reviews.freebsd.org/D10161


# 854023f0 14-Aug-2016 Xin LI <delphij@FreeBSD.org>

Add timingsafe_bcmp and timingsafe_memcmp.

Obtained from: OpenBSD
Reviewed by: trasz
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7280


# 51072bd6 23-Jul-2016 Dimitry Andric <dim@FreeBSD.org>

Vendor import of libc++ release_39 branch r276489:
https://llvm.org/svn/llvm-project/libcxx/branches/release_39@276489


# 448f5f73 11-May-2014 Jilles Tjoelker <jilles@FreeBSD.org>

include: Remove checks for __BSD_VISIBLE where redundant with __XSI_VISIBLE
or __POSIX_VISIBLE.

Whenever <sys/cdefs.h> sets __BSD_VISIBLE to non-zero, it also sets
__POSIX_VISIBLE and __XSI_VISIBLE to the newest version supported.

No functional change is intended.


# 4e95969e 14-Feb-2013 Niclas Zeising <zeising@FreeBSD.org>

FreeBSD uses #if __BSD_VISIBLE to hide non-standard functions, fix this.

Noticed by: kib
Approved by: kib


# d902844b 13-Feb-2013 Niclas Zeising <zeising@FreeBSD.org>

Add strchrnul(), a GNU function similar to strchr(), except that it returns
a pointer to the end of the string, rather than NULL, if the character was
not found.

Approved by: theraven


# 3ac9d659 27-Mar-2012 David Chisnall <theraven@FreeBSD.org>

Correctly expose xlocale functions if people include the headers in the wrong
order (as some ports apparently do).

Approved by: dim (mentor)


# a8ed63bb 04-Mar-2012 David Chisnall <theraven@FreeBSD.org>

Reapply 227753 (xlocale cleanup), plus some fixes so that it passes build
universe with gcc.

Approved by: dim (mentor)


# b74cf6dc 14-Feb-2012 Dimitry Andric <dim@FreeBSD.org>

Revert r231673 and r231682 for now, until we can run a full make
universe with them. Sorry for the breakage.

Pointy hat to: me and brooks


# 82dd5016 13-Feb-2012 David Chisnall <theraven@FreeBSD.org>

Cleanup of xlocale:

- Address performance regressions encountered by das@ by caching per-thread
data in TLS where available.
- Add a __NO_TLS flag to cdefs.h to indicate where not available.
- Reorganise the xlocale.h definitions into xlocale/*.h so that they can be
included from multiple places.
- Export the POSIX2008 subset of xlocale when POSIX2008 says it should be
exported, independently of whether xlocale.h is included.
- Fix the bug where programs using ctype functions always assumed ASCII unless
recompiled.
- Fix some style(9) violations.

Reviewed by: brooks (mentor)
Approved by: dim (mentor)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# f2556687 16-Feb-2010 Warner Losh <imp@FreeBSD.org>

Remove the Berkeley clause 3's.
Add a few $FreeBSD$


# dd5185d1 14-Mar-2009 David Schultz <das@FreeBSD.org>

Namespace: memccpy() and memchr() are XSI, and memrchr() is a BSD extension.


# 69099ba2 27-Feb-2009 David Schultz <das@FreeBSD.org>

- Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
getline()) cause issues with ports.

Reviewed by: standards@


# e00a6d21 27-Feb-2009 David Schultz <das@FreeBSD.org>

Add restrict qualifiers to the parameters to strlcpy() and strlcat().
The annotation mainly just serves as a hint that they're not intended
for use with overlapping strings.


# dce7ffd6 27-Feb-2009 David Schultz <das@FreeBSD.org>

Mark memmem() __pure.


# 544048ec 31-Jan-2009 David Schultz <das@FreeBSD.org>

Add a function attribute called `__malloc_like', which informs gcc
that the annotated function returns a pointer that doesn't alias any
extant pointer. This results in a 50%+ speedup in microbenchmarks such
as the following:

char *cp = malloc(1), *buf = malloc(BUF);
for (i = 0; i < BUF; i++) buf[i] = *cp;

In real programs, your mileage will vary. Note that gcc already
performs this optimization automatically for any function called
`malloc', `calloc', `strdup', or `strndup' unless -fno-builtins is
used.


# 20e76cb3 08-Dec-2008 Konstantin Belousov <kib@FreeBSD.org>

Add strndup(3) prototype to string.h.

This change was erronously ommitted from the r185690, and attempt
to simply add the prototype to string.h has revealed that several
contributed programs defined local prototypes for strndup(), controlled
by autoconfed config.h. So, manually change #undef HAVE_STRNDUP to
#define HAVE_STRNDUP 1. Next import of the corresponding program would
regenerate config.h, overriding the changes in this commit.

No objections from: kan


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 82e45205 09-Apr-2008 Xin LI <delphij@FreeBSD.org>

Add memrchr(3).

Obtained from: OpenBSD


# 52fbcc15 24-Nov-2005 Ruslan Ermilov <ru@FreeBSD.org>

Revert last revision, strmode() should be moved to <unistd.h> to be
properly fixed.


# fee45c0c 23-Nov-2005 Ruslan Ermilov <ru@FreeBSD.org>

Fix prototype of strmode() to match the code and documentation.


# da506dca 25-Aug-2005 Andre Oppermann <andre@FreeBSD.org>

Appropriate namespace protection for memmem(3).

Submitted by: wollman
MFC after: 3 days


# 6050c8fe 25-Aug-2005 Andre Oppermann <andre@FreeBSD.org>

Add the function memmem(3) as found in glibc and others.
It is the binary equivalent to strstr(3).

void *memmem(const void *big, size_t big_len,
const void *little, size_t little_len);

Submitted by: Pascal Gloor <pascal.gloor at spale.com>
MFC after: 3 days


# 2f5cde3c 10-Dec-2004 Tom Rhodes <trhodes@FreeBSD.org>

According to the information on:
http://www.opengroup.org/onlinepubs/009695399/functions/swab.html
the prototype for swab() should be in <unistd.h> and not in <string.h>.
Move it, and update to match SUS. Leave the prototype in string.h for
now, for backwards compat.

PR: 74751
Submitted by: Craig Rodrigues <rodrigc@crodrigues.org>
Discussed with: das


# 779f8b0d 22-Jul-2004 Tim J. Robbins <tjr@FreeBSD.org>

Mark functions pure where applicable. A notable exclusion is strcoll(),
which is not strictly pure because it calls malloc()/free() in some cases.


# 12eb46c8 07-Dec-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
by virtue of the generated code implicitly widens ints to longs and
allows the use of an 32-bit integral type for 64-bit arguments.
Subsequent arguments are passed onto the memory stack, which does
not exhibit the same behaviour and consequently do not allow this.
In practice this means that variadic functions taking pointers
and given NULL (without cast) work as long as the NULL is passed
in one of the first 8 arguments. A SIGSEGV is more likely the
result if such would be done for stack-based arguments. This is
due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
exception of ia64, allow 32-bit integral types (specifically NULL)
when 64-bit pointers are expected in variadic functions by way of
how the compiler generates code. As such, code that works correctly
(whether rightfully so or not) on any platform other than ia64, may
fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...


# 32484af1 14-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

Correct visibility conditionals for memccpy(), strdup(), and
strtok_r(). Merge conditional prototypes into the regular block.


# 103f8a93 05-Oct-2002 David E. O'Brien <obrien@FreeBSD.org>

Make stpcpy() only visiable w/in __BSD_VISIBLE.


# 1d6bd7d7 03-Oct-2002 David E. O'Brien <obrien@FreeBSD.org>

Add stpcpy(3).


# abbd8902 21-Aug-2002 Mike Barcroft <mike@FreeBSD.org>

o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif

Concept by: bde
Reviewed by: jake, obrien


# 6e070759 14-Apr-2002 Mike Barcroft <mike@FreeBSD.org>

Add support for X/Open.

PR: 37078


# 61b60edf 03-Apr-2002 Mike Barcroft <mike@FreeBSD.org>

o Move some function prototypes from <string.h> to the newly rewritten
<strings.h>, based on POSIX.1-2001's requirements.
o Add 'restrict' qualifier (spelled '__restrict') to functions in
<string.h>, as per C99 and POSIX.1-2001.
o Properly expose new POSIX.1-2001 functions in <string.h>.


# bb28f3c2 23-Mar-2002 Warner Losh <imp@FreeBSD.org>

Breath deep and take __P out of the system include files.

# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.


# d23c1cd5 28-Nov-2001 Bruce Evans <bde@FreeBSD.org>

Fixed namespace pollution in previous commit. The C99 function
sterror_r() must not be declared in the C90/POSIX.1-1990 section.
Put it in the nonstandard section for now.


# 9c324dc0 27-Nov-2001 Wes Peters <wes@FreeBSD.org>

Add strerror_r function per Posix prototype.

Reviewed by: Mike Barcroft <mike@FreeBSD.org>
MFC after: 2 weeks


# 4546f902 10-Oct-2001 Bruce Evans <bde@FreeBSD.org>

Fixed some style bugs:
- rev.1.6: corrupt tab before strlcpy.
- rev.1.7: "From: " in vendor id.
- rev.1.8: unsorted prototype for strccasestr.


# a7ad1cac 09-Oct-2001 Andrey A. Chernov <ache@FreeBSD.org>

Implement strcasestr() which many others (f.e. Linux) already have


# 41036d78 08-Oct-2001 Mike Barcroft <mike@FreeBSD.org>

Add a new libc function, strnstr(3), which allows one to limit the
number of characters that are searched. This is especially useful
with file operations and non-NUL terminated strings.

Silence from: -audit, -hackers
MFC after: 5 days


# c0344bf0 16-Aug-1999 Warner Losh <imp@FreeBSD.org>

Add prototypes for strl* functions

Forgotten by: imp
Reported by: bde


# 78121e79 17-May-1999 Peter Wemm <peter@FreeBSD.org>

Add a strsignal(3) (like strerror(3)) for libc compatability with other
systems. NetBSD, Linux, SVR4 etc all have it.


# 5d00b6cc 20-Jan-1999 John Polstra <jdp@FreeBSD.org>

Add a prototype for strtok_r().


# 2ad334cd 17-Dec-1996 Warner Losh <imp@FreeBSD.org>

string.h defines nonstandard routines when _POSIX_SOURCE is
defined. It has been fixed to not do that.

Submitted by: Jake Hamby <jehamby@lightside.com>
Closes PR: 1954


# 4399be3c 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 59deaec5 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Include Sources