Skip to content

Commit

Permalink
locale.c: don't use strcpy()
Browse files Browse the repository at this point in the history
A recent commit added a strcpy() to locale.c.

This is Frowned Upon, and was making porting/libperl.t fail.

Since PL_strxfrm_min_char appears to be a 3-byte buffer, I've just changed
it to manually copy 3 individual bytes - which is probably more efficient
than a full-blown Copy(). But I haven't looked closely at whether this is
correct - this is more of quick fix to get smoking passing again.
  • Loading branch information
iabyn committed May 24, 2016
1 parent 17f4103 commit 81547f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion locale.c
Expand Up @@ -1525,7 +1525,9 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
|| strLT(x + COLLXFRM_HDR_LEN,
cur_min_x + COLLXFRM_HDR_LEN))
{
strcpy(PL_strxfrm_min_char, cur_source);
PL_strxfrm_min_char[0] = cur_source[0];
PL_strxfrm_min_char[1] = cur_source[1];
PL_strxfrm_min_char[2] = cur_source[2];
cur_min_x = x;
#ifdef DEBUGGING
cur_min_cp = j;
Expand Down

0 comments on commit 81547f2

Please sign in to comment.