From 992b2c400be6be16479c956003833fe0a05f1d7a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 5 Mar 1997 20:28:57 +0000 Subject: Correct handling of `position' levels with no non-IGNOREd element and handling of NUL byte. --- locale/weight.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'locale') diff --git a/locale/weight.h b/locale/weight.h index 424e493209..ef767bac59 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -55,8 +55,8 @@ typedef struct weight_t ((u_int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_RULES)) -static __inline int get_weight (const STRING_TYPE **str, weight_t *result); -static __inline int +static __inline void get_weight (const STRING_TYPE **str, weight_t *result); +static __inline void get_weight (const STRING_TYPE **str, weight_t *result) { unsigned int ch = *((USTRING_TYPE *) (*str))++; @@ -86,7 +86,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) result->data[cnt].value = &__collate_extra[idx]; idx += result->data[cnt].number; } - return 0; + return; } slot += level_size; } @@ -102,7 +102,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) result->data[cnt].number = 1; result->data[cnt].value = &__collate_table[slot + 1 + cnt]; } - return ch == 0; + return; } /* We now look for any collation element which starts with CH. @@ -135,14 +135,12 @@ get_weight (const STRING_TYPE **str, weight_t *result) result->data[cnt].value = &__collate_extra[idx]; idx += result->data[cnt].number; } - return 0; + return; } /* To next entry in list. */ slot += __collate_extra[slot]; } - /* NOTREACHED */ - return 0; /* To calm down gcc. */ } @@ -155,7 +153,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) do \ { \ weight_t *newp; \ - do \ + while (*str != '\0') \ { \ newp = (weight_t *) alloca (sizeof (weight_t) \ + (collate_nrules \ @@ -168,7 +166,7 @@ get_weight (const STRING_TYPE **str, weight_t *result) backw->next = newp; \ newp->next = NULL; \ backw = newp; \ + get_weight (&str, newp); \ } \ - while (get_weight (&str, newp) == 0); \ } \ while (0) -- cgit v1.2.3