Skip to content

Commit

Permalink
Constify.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Nov 7, 2023
1 parent f9f1681 commit a7b3b89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 10 additions & 2 deletions charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,11 @@ public void put_wchar(char **pp, LWCHAR ch)
/*
* Step forward or backward one character in a string.
*/
public LWCHAR step_char(char **pp, signed int dir, constant char *limit)
public LWCHAR step_charc(constant char **pp, signed int dir, constant char *limit)
{
LWCHAR ch;
int len;
char *p = *pp;
constant char *p = *pp;

if (!utf_mode)
{
Expand Down Expand Up @@ -803,6 +803,14 @@ public LWCHAR step_char(char **pp, signed int dir, constant char *limit)
return ch;
}

public LWCHAR step_char(char **pp, signed int dir, constant char *limit)
{
constant char *p = (constant char *) *pp;
LWCHAR ch = step_charc(&p, dir, limit);
*pp = (char *) p;
return ch;
}

/*
* Unicode characters data
* Actual data is in the generated *.uni files.
Expand Down
8 changes: 4 additions & 4 deletions cvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public int * cvt_alloc_chpos(int len)
* Returns converted text in odst. The original offset of each
* odst character (when it was in osrc) is returned in the chpos array.
*/
public void cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops)
public void cvt_text(char *odst, constant char *osrc, int *chpos, int *lenp, int ops)
{
char *dst;
char *edst = odst;
char *src;
char *src_end;
constant char *src;
constant char *src_end;
LWCHAR ch;

if (lenp != NULL)
Expand All @@ -67,7 +67,7 @@ public void cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops)
int src_pos = (int) (src - osrc);
int dst_pos = (int) (dst - odst);
struct ansi_state *pansi;
ch = step_char(&src, +1, src_end);
ch = step_charc(&src, +1, src_end);
if ((ops & CVT_BS) && ch == '\b' && dst > odst)
{
/* Delete backspace and preceding char. */
Expand Down

0 comments on commit a7b3b89

Please sign in to comment.