3
0
forked from pool/coreutils
coreutils/i18n-limfield.diff
OBS User autobuild c76409f6df Accepting request 39394 from Base:System
Copy from Base:System/coreutils based on submit request 39394 from user psmt

OBS-URL: https://build.opensuse.org/request/show/39394
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=39
2010-05-05 20:22:09 +00:00

101 lines
2.9 KiB
Diff

Index: src/sort.c
===================================================================
--- src/sort.c.orig 2010-05-04 17:29:12.419359202 +0200
+++ src/sort.c 2010-05-04 17:29:12.479359419 +0200
@@ -1731,7 +1731,7 @@ limfield_mb (const struct line *line, co
GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
ptr += mblength;
}
- if (ptr < lim)
+ if (ptr < lim && (eword | echar))
{
GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
ptr += mblength;
@@ -1742,11 +1742,6 @@ limfield_mb (const struct line *line, co
{
while (ptr < lim && ismbblank (ptr, &mblength))
ptr += mblength;
- if (ptr < lim)
- {
- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
- ptr += mblength;
- }
while (ptr < lim && !ismbblank (ptr, &mblength))
ptr += mblength;
}
@@ -1756,20 +1751,19 @@ limfield_mb (const struct line *line, co
/* Make LIM point to the end of (one byte past) the current field. */
if (tab != NULL)
{
- char *newlim, *p;
+ char *newlim;
- newlim = NULL;
- for (p = ptr; p < lim;)
- {
- if (memcmp (p, tab, tab_length) == 0)
- {
- newlim = p;
- break;
- }
-
- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
- p += mblength;
- }
+ for (newlim = ptr; newlim < lim;)
+ {
+ if (memcmp (newlim, tab, tab_length) == 0)
+ {
+ lim = newlim;
+ break;
+ }
+
+ GET_BYTELEN_OF_CHAR (lim, newlim, mblength, state);
+ newlim += mblength;
+ }
}
else
{
@@ -1778,24 +1772,20 @@ limfield_mb (const struct line *line, co
while (newlim < lim && ismbblank (newlim, &mblength))
newlim += mblength;
- if (ptr < lim)
- {
- GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
- ptr += mblength;
- }
while (newlim < lim && !ismbblank (newlim, &mblength))
- newlim += mblength;
+ newlim += mblength;
lim = newlim;
}
# endif
- /* If we're skipping leading blanks, don't start counting characters
- until after skipping past any leading blanks. */
+ /* If we're ignoring leading blanks when computing the End
+ of the field, don't start counting bytes until after skipping
+ past any leading blanks. */
if (key->skipeblanks)
while (ptr < lim && ismbblank (ptr, &mblength))
ptr += mblength;
- memset (&state, '\0', sizeof(mbstate_t));
+ memset (&state, '\0', sizeof (mbstate_t));
/* Advance PTR by ECHAR (if possible), but no further than LIM. */
for (i = 0; i < echar; i++)
@@ -1803,9 +1793,9 @@ limfield_mb (const struct line *line, co
GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
if (ptr + mblength > lim)
- break;
+ break;
else
- ptr += mblength;
+ ptr += mblength;
}
return ptr;