diff --git a/src/browser.c b/src/browser.c index b61bfdd5..286a5339 100644 --- a/src/browser.c +++ b/src/browser.c @@ -587,7 +587,7 @@ void browser_refresh(void) /* Make sure info takes up no more than infomaxlen columns. */ infolen = strlenpt(info); if (infolen > infomaxlen) { - null_at(&info, actual_x(info, infomaxlen)); + info[actual_x(info, infomaxlen)] = '\0'; infolen = infomaxlen; } diff --git a/src/files.c b/src/files.c index 6fa9a1fc..aba75a36 100644 --- a/src/files.c +++ b/src/files.c @@ -1028,9 +1028,8 @@ char *get_next_filename(const char *name, const char *suffix) sprintf(buf + wholenamelen, ".%lu", i); } - /* We get here only if there is no possible save file. Blank out - * the filename to indicate this. */ - null_at(&buf, 0); + /* There is no possible save file: blank out the filename. */ + *buf = '\0'; return buf; } @@ -1228,7 +1227,7 @@ char *get_full_path(const char *origpath) /* How often we've tried climbing back up the tree. */ struct stat fileinfo; char *currentdir, *d_here, *d_there, *d_there_file = NULL; - const char *last_slash; + char *last_slash; bool path_only; if (origpath == NULL) @@ -1294,7 +1293,7 @@ char *get_full_path(const char *origpath) d_there_file = mallocstrcpy(NULL, last_slash + 1); /* Remove the filename portion of the answer from d_there. */ - null_at(&d_there, last_slash - d_there + 1); + *(last_slash + 1) = '\0'; /* Go to the path specified in d_there. */ if (chdir(d_there) == -1) { @@ -2503,7 +2502,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t const struct dirent *nextdir; *num_matches = 0; - null_at(&dirname, buf_len); + dirname[buf_len] = '\0'; /* If there's a / in the name, split out filename and directory parts. */ slash = strrchr(dirname, '/'); diff --git a/src/nano.c b/src/nano.c index a8c2a7fd..9d61f66a 100644 --- a/src/nano.c +++ b/src/nano.c @@ -228,7 +228,7 @@ partition *partition_filestruct(filestruct *top, size_t top_x, p->bot_data = mallocstrcpy(NULL, bot->data + bot_x); /* Remove all text after bot_x at the bottom of the partition. */ - null_at(&bot->data, bot_x); + bot->data[bot_x] = '\0'; /* Remove all text before top_x at the top of the partition. */ charmove(top->data, top->data + top_x, strlen(top->data) - top_x + 1); diff --git a/src/prompt.c b/src/prompt.c index 8dceece0..60f7561c 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -296,7 +296,7 @@ void do_statusbar_cut_text(void) if (!ISSET(CUT_TO_END)) statusbar_x = 0; - null_at(&answer, statusbar_x); + answer[statusbar_x] = '\0'; update_the_statusbar(); } @@ -637,7 +637,7 @@ int do_prompt(bool allow_tabs, bool allow_files, vsnprintf(prompt, COLS * mb_cur_max(), msg, ap); va_end(ap); /* Reserve five columns for colon plus angles plus answer, ":". */ - null_at(&prompt, actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)); + prompt[actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)] = '\0'; func = acquire_an_answer(&retval, allow_tabs, allow_files, &listed, #ifndef DISABLE_HISTORIES diff --git a/src/search.c b/src/search.c index a7217036..528995ac 100644 --- a/src/search.c +++ b/src/search.c @@ -1046,7 +1046,7 @@ void do_find_bracket(void) bracket_set = charalloc((mb_cur_max() * 2) + 1); strncpy(bracket_set, ch, ch_len); strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len); - null_at(&bracket_set, ch_len + wanted_ch_len); + bracket_set[ch_len + wanted_ch_len] = '\0'; found_ch = charalloc(mb_cur_max() + 1); diff --git a/src/text.c b/src/text.c index f6cb73e3..e4ac6916 100644 --- a/src/text.c +++ b/src/text.c @@ -1226,7 +1226,7 @@ void add_undo(undo_type action) char *char_buf = charalloc(mb_cur_max() + 1); int char_len = parse_mbchar(&openfile->current->data[u->begin], char_buf, NULL); - null_at(&char_buf, char_len); + char_buf[char_len] = '\0'; u->strdata = char_buf; if (u->type == BACK) u->mark_begin_x += char_len;