mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-17 13:00:43 +08:00
* string/Makefile (tst-strxfrm2-ENV): Define.
* string/strxfrm_l.c (STRXFRM): Fix trailing \1 optimization if N is one bigger than return value. * string/tst-strxfrm2.c (do_test): Also test strxfrm with l1 + 1 and l1 last arguments, if buf is defined, verify the return value equals to strlen (buf) and verify no byte beyond passed length is modified. * string/Makefile (tests): Add tst-strxfrm2. * string/tst-strxfrm2.c: New file. * string/strxfrm_l.c (STRXFRM): Do the trailing \1 removal optimization even if needed > n.
This commit is contained in:
parent
cf7056af7b
commit
2d54f6629e
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
|||||||
|
2007-01-03 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* string/Makefile (tst-strxfrm2-ENV): Define.
|
||||||
|
|
||||||
|
2006-11-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* string/strxfrm_l.c (STRXFRM): Fix trailing \1 optimization
|
||||||
|
if N is one bigger than return value.
|
||||||
|
* string/tst-strxfrm2.c (do_test): Also test strxfrm with l1 + 1
|
||||||
|
and l1 last arguments, if buf is defined, verify the return value
|
||||||
|
equals to strlen (buf) and verify no byte beyond passed length
|
||||||
|
is modified.
|
||||||
|
|
||||||
|
2006-11-09 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* string/Makefile (tests): Add tst-strxfrm2.
|
||||||
|
* string/tst-strxfrm2.c: New file.
|
||||||
|
|
||||||
|
2006-11-08 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* string/strxfrm_l.c (STRXFRM): Do the trailing \1 removal
|
||||||
|
optimization even if needed > n.
|
||||||
|
|
||||||
2006-12-22 Gavin Romig-Koch <gavin@redhat.com>
|
2006-12-22 Gavin Romig-Koch <gavin@redhat.com>
|
||||||
|
|
||||||
* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Don't
|
* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Don't
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 1991-2002, 2005, 2006 Free Software Foundation, Inc.
|
# Copyright (C) 1991-2002, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
# This file is part of the GNU C Library.
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
# The GNU C Library is free software; you can redistribute it and/or
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -54,7 +54,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
|
|||||||
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
|
bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
|
||||||
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
|
||||||
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
bug-strtok1 $(addprefix test-,$(strop-tests)) \
|
||||||
bug-envz1
|
bug-envz1 tst-strxfrm2
|
||||||
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h
|
distribute := memcopy.h pagecopy.h tst-svc.expect test-string.h
|
||||||
|
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ tester-ENV = LANGUAGE=C
|
|||||||
inl-tester-ENV = LANGUAGE=C
|
inl-tester-ENV = LANGUAGE=C
|
||||||
noinl-tester-ENV = LANGUAGE=C
|
noinl-tester-ENV = LANGUAGE=C
|
||||||
tst-strxfrm-ENV = LOCPATH=$(common-objpfx)localedata
|
tst-strxfrm-ENV = LOCPATH=$(common-objpfx)localedata
|
||||||
|
tst-strxfrm2-ENV = LOCPATH=$(common-objpfx)localedata
|
||||||
bug-strcoll1-ENV = LOCPATH=$(common-objpfx)localedata
|
bug-strcoll1-ENV = LOCPATH=$(common-objpfx)localedata
|
||||||
CFLAGS-inl-tester.c = -fno-builtin
|
CFLAGS-inl-tester.c = -fno-builtin
|
||||||
CFLAGS-noinl-tester.c = -fno-builtin
|
CFLAGS-noinl-tester.c = -fno-builtin
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 1995,96,97,2002, 2004, 2005 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997, 2002, 2004, 2005, 2006
|
||||||
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
|
|||||||
const int32_t *indirect;
|
const int32_t *indirect;
|
||||||
uint_fast32_t pass;
|
uint_fast32_t pass;
|
||||||
size_t needed;
|
size_t needed;
|
||||||
|
size_t last_needed;
|
||||||
const USTRING_TYPE *usrc;
|
const USTRING_TYPE *usrc;
|
||||||
size_t srclen = STRLEN (src);
|
size_t srclen = STRLEN (src);
|
||||||
int32_t *idxarr;
|
int32_t *idxarr;
|
||||||
@ -197,6 +199,7 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
|
|||||||
this is true for all of them. */
|
this is true for all of them. */
|
||||||
int position = rule & sort_position;
|
int position = rule & sort_position;
|
||||||
|
|
||||||
|
last_needed = needed;
|
||||||
if (position == 0)
|
if (position == 0)
|
||||||
{
|
{
|
||||||
for (idxcnt = 0; idxcnt < idxmax; ++idxcnt)
|
for (idxcnt = 0; idxcnt < idxmax; ++idxcnt)
|
||||||
@ -426,11 +429,11 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
|
|||||||
a `position' rule at the end and if no non-ignored character
|
a `position' rule at the end and if no non-ignored character
|
||||||
is found the last \1 byte is immediately followed by a \0 byte
|
is found the last \1 byte is immediately followed by a \0 byte
|
||||||
signalling this. We can avoid the \1 byte(s). */
|
signalling this. We can avoid the \1 byte(s). */
|
||||||
if (needed <= n && needed > 2 && dest[needed - 2] == L('\1'))
|
if (needed > 2 && needed == last_needed + 1)
|
||||||
{
|
{
|
||||||
/* Remove the \1 byte. */
|
/* Remove the \1 byte. */
|
||||||
--needed;
|
if (--needed <= n)
|
||||||
dest[needed - 1] = L('\0');
|
dest[needed - 1] = L('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the memory if needed. */
|
/* Free the memory if needed. */
|
||||||
|
Loading…
Reference in New Issue
Block a user