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 98acbb0 commit 5a6c532
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cmdbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ public void cmd_putstr(constant char *s)
constant char *endline = s + strlen(s);
while (*s != '\0')
{
char *ns = (char *) s;
constant char *os = s;
int width;
ch = step_char(&ns, +1, endline);
while (s < ns)
putchr(*s++);
ch = step_charc(&s, +1, endline);
while (os < s)
putchr(*os++);
if (!utf_mode)
width = 1;
else if (is_composing_char(ch) || is_combining_char(prev_ch, ch))
Expand All @@ -169,13 +169,13 @@ public void cmd_putstr(constant char *s)
*/
public int len_cmdbuf(void)
{
char *s = cmdbuf;
char *endline = s + strlen(s);
constant char *s = cmdbuf;
constant char *endline = s + strlen(s);
int len = 0;

while (*s != '\0')
{
step_char(&s, +1, endline);
step_charc(&s, +1, endline);
len++;
}
return (len);
Expand Down Expand Up @@ -903,14 +903,14 @@ static int cmd_edit(int c)
*/
static int cmd_istr(constant char *str)
{
char *s;
int action;
constant char *endline = str + strlen(str);
constant char *s;
int action;

for (s = (char *) str; *s != '\0'; ) /*{{const-issue}}*/
for (s = str; *s != '\0'; )
{
char *os = s;
step_char(&s, +1, endline);
constant char *os = s;
step_charc(&s, +1, endline);
action = cmd_ichar(os, s - os);
if (action != CC_OK)
return (action);
Expand Down Expand Up @@ -1408,7 +1408,6 @@ static void read_cmdhist2(void (*action)(void*,struct mlist*,constant char*), vo
char line[CMDBUF_SIZE];
char *filename;
FILE *f;
char *p;
int *skip = NULL;

filename = histfile_name(1);
Expand All @@ -1426,6 +1425,7 @@ static void read_cmdhist2(void (*action)(void*,struct mlist*,constant char*), vo
}
while (fgets(line, sizeof(line), f) != NULL)
{
char *p;
for (p = line; *p != '\0'; p++)
{
if (*p == '\n' || *p == '\r')
Expand Down Expand Up @@ -1526,7 +1526,7 @@ static void write_mlist(struct mlist *ml, FILE *f)
/*
* Make a temp name in the same directory as filename.
*/
static char * make_tempname(char *filename)
static char * make_tempname(constant char *filename)
{
char lastch;
char *tempname = ecalloc(1, strlen(filename)+1);
Expand Down

0 comments on commit 5a6c532

Please sign in to comment.