Skip to content

Commit

Permalink
Merge r308330 by bapt:
Browse files Browse the repository at this point in the history
  localedef: Fix ctype dump (fixed wide spread errors)

See original commit for longer description.

Errata Notice:	EN-16:21
Approved by:	so
  • Loading branch information
glebius authored and fichtner committed Dec 6, 2016
1 parent 81ef9b0 commit bc28f71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion contrib/netbsd-tests/lib/libc/locale/t_mbstowcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static struct test {
0xFFFF, 0x5D, 0x5B, 0x10000, 0x10FFFF, 0x5D, 0x0A
},
#ifdef __FreeBSD__
{ 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1,
{ 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1,
#else
{ 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1,
#endif
Expand Down
6 changes: 3 additions & 3 deletions usr.bin/localedef/ctype.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,18 @@ dump_ctype(void)
continue;
}

if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype)) {
if ((last_ct != NULL) && (last_ct->ctype == ctn->ctype) &&
(last_ct->wc + 1 == wc)) {
ct[rl.runetype_ext_nranges-1].max = wc;
last_ct = ctn;
} else {
rl.runetype_ext_nranges++;
ct = realloc(ct,
sizeof (*ct) * rl.runetype_ext_nranges);
ct[rl.runetype_ext_nranges - 1].min = wc;
ct[rl.runetype_ext_nranges - 1].max = wc;
ct[rl.runetype_ext_nranges - 1].map = ctn->ctype;
last_ct = ctn;
}
last_ct = ctn;
if (ctn->tolower == 0) {
last_lo = NULL;
} else if ((last_lo != NULL) &&
Expand Down
23 changes: 11 additions & 12 deletions usr.bin/localedef/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/

/*
Expand Down Expand Up @@ -321,21 +323,18 @@ ctype_kw : T_ISUPPER cc_list T_NL
| T_TOLOWER conv_list T_NL
;

cc_list : cc_list T_SEMI cc_range_end
| cc_list T_SEMI cc_char
| cc_char
;

cc_list : cc_list T_SEMI T_CHAR
{
add_ctype($3);
}
| cc_list T_SEMI T_SYMBOL
{
add_charmap_undefined($3);
}
| cc_list T_SEMI T_ELLIPSIS T_SEMI T_CHAR
cc_range_end : T_ELLIPSIS T_SEMI T_CHAR
{
/* note that the endpoints *must* be characters */
add_ctype_range($5);
add_ctype_range($3);
}
| T_CHAR
;

cc_char : T_CHAR
{
add_ctype($1);
}
Expand Down

0 comments on commit bc28f71

Please sign in to comment.