History log of /freebsd-10.0-release/lib/libc/locale/collate.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 244126 11-Dec-2012 jilles

libc: Make various internal file descriptors close-on-exec.

These are obtained via fopen().


# 238182 06-Jul-2012 theraven

Restore the __collate_load_error global that was accidentally removed in the
xlocale refactoring.

MFC after: 1 week


# 232601 06-Mar-2012 theraven

Remove some duplicated copyright notices.

Approved by: dim (mentor)


# 227753 20-Nov-2011 theraven

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)


# 142686 27-Feb-2005 ru

Make the format of LC_COLLATE files architecture independent.


# 142653 27-Feb-2005 phantom

ANSI'fy prototypes


# 135576 22-Sep-2004 stefanf

Prefer C99's __func__ over GCC's __FUNCTION__.


# 106119 29-Oct-2002 tjr

Remove unnecessary inclusion of <rune.h> to make it obvious that this file
does not use the deprecated rune system.


# 102658 30-Aug-2002 ache

Use ntohl() to read cnains number in new format


# 102641 30-Aug-2002 ache

Style fix


# 102638 30-Aug-2002 ache

Prepare for switching to unlimited chains format.
Optimize chains lookup a bit.


# 101820 13-Aug-2002 ache

Reduce BSS size for programs which not load collate by eliminating
static buffer.


# 101747 12-Aug-2002 ache

Now malloc() is fixed, remove errno hardcoding to ENOMEM


# 101498 08-Aug-2002 ache

Rewrite locale loading procedures, so any load failure will not affect
currently cached data. It allows a number of nice things, like: removing
fallback code from single locale loading, remove memory leak when LC_CTYPE
data loaded again and again, efficient cache use, not only for
setlocale(locale1); setlocale(locale1), but for setlocale(locale1);
setlocale("C"); setlocale(locale1) too (i.e. data file loaded only once).


# 101478 07-Aug-2002 ache

Style fixes in preparation for rewritting


# 93399 29-Mar-2002 markm

Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.


# 92986 22-Mar-2002 obrien

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


# 71579 24-Jan-2001 deischen

Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions. If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
__sys_foo - actual system call
_foo - weak definition to __sys_foo
foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo. In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde). All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes. <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE. We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by: -arch


# 56698 27-Jan-2000 jasone

Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo(). In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate. In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by: deischen


# 55837 12-Jan-2000 jasone

Add three-tier symbol naming in support of POSIX thread cancellation
points. For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep(). The arrows represent weak aliases. For
system calls, the pattern is _read() <-- _libc_read() <-- read().


# 51216 12-Sep-1999 dt

__collate_substitute() do something non-trivial only for German. For everyone
else, it is equivalent to strdup(). So, we will check if the substitution
tables are trivial at the load time, and possibly save 2 calls to
__collate_substitute() in strcoll().

Still, __collate_substitute() should not exist.


# 51214 12-Sep-1999 dt

Reduce time of __collate_substitute() from O(strlen(s)^2) to O(strlen(s)).
Other minor optimizations. I got ~30% speedup in strcoll() for 50 char strings,
~40% speedup for 100 char strings, and unmeasurable speedup for 1M strings.

Collates are still terribly slow. To make them reasonable fast,
__collate_substitute() should be killed.


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 39327 16-Sep-1998 imp

Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x). Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time. However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes. Shouldn't impact anything, but...


# 22993 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 22330 06-Feb-1997 ache

Use symbolic constants instead of hardcoded digits
Add range check for setrunelocale since it can be called
directly.
Remove _startup_setlocale compatibility function

Should go into 2.2


# 22304 05-Feb-1997 ache

Update the comment why range checking not needed

Fix setrunelocale fail if called directly without prior setlocale
call

Should go in 2.2


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 20961 28-Dec-1996 ache

Add comment that range checking is already done at upper level
Kill snprintf left in collate.c from previous backout

Should go in 2.2


# 20552 16-Dec-1996 joerg

Fix yet another buffer overflow. :-(

Vulnerable: all programs that use setlocale(LC_COLLATE),
setlocale(LC_CTYPE), or setlocale(LC_ALL). The only setuid/setgid
binary i've found for this is w(1).

Should go into 2.2.


# 19964 26-Nov-1996 ache

PATH_LOCALE: use this non-standard env variable first time only, i.e.
strdup() it to prevent unsetenv() or setenv() effects. Check its length to
not allow user to overflow internal locale buffer. Move PATH_LOCALE
handling code into one place.

POSIX: make better stub for LC_MONETARY & LC_NUMERIC, now it check
locale directory existance instead of refusing all non-C non-POSIX
locales. POSIX treats empty locale env variable as unset variable
while our old code treats it as "C" locale, fix it. Implement previous locale
restoring, if locale setting fails. Old code assumes success if some
of LC_ALL subset is successed even other fails, POSIX treats it as
failure with previous locale restoring, fix it.

Remove unneccessary length checking in currentlocale()


# 19129 23-Oct-1996 ache

Simplify debug output
Simplify collate_range_cmp for ASCII-compatible collate we have now


# 18949 15-Oct-1996 ache

Save half of space in LC_COLLATE and remove unneded code.
This change is not compatible with previous variant, however proper
error code returned in both cases.
Colldef changes will follows.


# 18286 14-Sep-1996 bde

Don't use __dead or __pure in user code. They were obfuscations
for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2
or __pure2 where it wasn't already done, except in math.h where use
of __pure was mostly wrong.


# 11736 23-Oct-1995 ache

Optimize PathLocale handling.
Handle C/POSIX/"" properly.
Don't reset collate to C when it is unnecessary


# 8870 30-May-1995 rgrimes

Remove trailing whitespace.


# 6538 17-Feb-1995 ache

Minor optimization


# 6523 17-Feb-1995 ache

Don't pick _warn module now


# 6485 16-Feb-1995 ache

Add 8-bit collate stuff
Submitted by: alex@elvisti.kiev.ua