summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-05 20:28:57 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-05 20:28:57 +0000
commit992b2c400be6be16479c956003833fe0a05f1d7a (patch)
tree3161a39e3deabac2a4a4f669a1e204adb5f096e8 /locale
parent6145c5ea692b73d2bec98c4cb6ad4012916c005d (diff)
Correct handling of `position' levels with no non-IGNOREd element and
handling of NUL byte.
Diffstat (limited to 'locale')
-rw-r--r--locale/weight.h16
1 files changed, 7 insertions, 9 deletions
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)