diff --git a/src/browser.c b/src/browser.c index b61bfdd5ef78a94cd613f2544c49ad36a318c01a..286a5339dd127b51d86182c65deb2a904ddfd9b3 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 6fa9a1fc9dfec96ca1aafc15bffb2a2244b259fd..aba75a369dbca7eef11d761024d15835b51f357d 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 a8c2a7fdc863fa08708581894198d9acd8973d0f..9d61f66a422f5ca294559e724e5899730e51bc63 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 8dceece0bbfb76d19210597409f4f2b2970758d5..60f7561cefc1285212c5f9cb8089064a73133f66 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, ":<aa>". */ - 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 a721703669d0bdd58e1d4230e07166c5c0807c59..528995ac3214b84fcc54433436f95a76bce4516b 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 f6cb73e367979dfac81941cf52a3872719e1325a..e4ac691696d955305df72a48738d361e11dea2ea 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;