Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/locale/collate.c
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
#include "un-namespace.h" | #include "un-namespace.h" | ||||
#include "collate.h" | #include "collate.h" | ||||
#include "setlocale.h" | #include "setlocale.h" | ||||
#include "ldpart.h" | #include "ldpart.h" | ||||
#include "libc_private.h" | #include "libc_private.h" | ||||
struct xlocale_collate __xlocale_global_collate = { | struct xlocale_collate __xlocale_global_collate = { | ||||
{{0}, "C"}, 1, 0, 0, 0 | { .locale = "C"}, .__collate_load_error = 1 /* XXX: right field? */ | ||||
}; | }; | ||||
struct xlocale_collate __xlocale_C_collate = { | struct xlocale_collate __xlocale_C_collate = { | ||||
{{0}, "C"}, 1, 0, 0, 0 | { .locale = "C"}, .__collate_load_error = 1 | ||||
}; | }; | ||||
static int | static int | ||||
__collate_load_tables_l(const char *encoding, struct xlocale_collate *table); | __collate_load_tables_l(const char *encoding, struct xlocale_collate *table); | ||||
static void | static void | ||||
destruct_collate(void *t) | destruct_collate(void *t) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | if ((fd = _open(buf, O_RDONLY)) < 0) { | ||||
free(buf); | free(buf); | ||||
return (_LDP_ERROR); | return (_LDP_ERROR); | ||||
} | } | ||||
free(buf); | free(buf); | ||||
if (_fstat(fd, &sbuf) < 0) { | if (_fstat(fd, &sbuf) < 0) { | ||||
(void) _close(fd); | (void) _close(fd); | ||||
return (_LDP_ERROR); | return (_LDP_ERROR); | ||||
} | } | ||||
if (sbuf.st_size < (COLLATE_FMT_VERSION_LEN + | if ((unsigned long)sbuf.st_size < (COLLATE_FMT_VERSION_LEN + | ||||
XLOCALE_DEF_VERSION_LEN + | XLOCALE_DEF_VERSION_LEN + | ||||
sizeof (info))) { | sizeof (info))) { | ||||
(void) _close(fd); | (void) _close(fd); | ||||
errno = EINVAL; | errno = EINVAL; | ||||
return (_LDP_ERROR); | return (_LDP_ERROR); | ||||
} | } | ||||
map = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); | map = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); | ||||
(void) _close(fd); | (void) _close(fd); | ||||
▲ Show 20 Lines • Show All 569 Lines • Show Last 20 Lines |