get_history_completion(), do_search(), do_replace(),
nanogetstr(), and statusq(); removal of remove_node() and
insert_node(). (DLR)
- - Replace all instances of strncpy() with charcpy(), since the
+ - Replace more instances of strncpy() with charcpy(), since the
only difference between them is that the former pads strings
with nulls when they're longer than the number of characters
- specified, which doesn't appear to be used anywhere. Changes
- to input_tab(), do_browser(), do_enter(), replace_regexp(),
- replace_line(), and mallocstrncpy(). (DLR)
+ specified, which isn't always used. Changes to input_tab(),
+ do_enter(), replace_regexp(), and replace_line(). (DLR)
- When using a backup directory, make sure all the filenames
written are unique by using get_next_filename() when
necessary. Changes to get_next_filename(), write_file(),
- Add multibyte/wide character support, so that we don't end up
with a string that contains only part of a multibyte
character during tab completion. (DLR)
+ - Rename variable buflen to buf_len, for consistency. (DLR)
do_browser()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR)
consistency. (DLR)
- Make mouse clicks in the browser window work properly when the
MORE_SPACE flag is set. (DLR)
+ - Make foo_len a size_t instead of an int. (DLR)
save_history()
- Properly save history when we're in view mode. (DLR)
- global.c:
- Start the search for a line from fileage instead of current
(again). (DLR)
replace_regexp()
- - Rename variable create_flag to create for consistency. (DLR)
+ - Rename variables create_flag and new_size to create and
+ new_line_size, for consistency. (DLR)
+ - Make new_line_size, search_match_count, and i size_t's, for
+ consistency. (DLR)
replace_line()
- Make new_line_size and search_match_count size_t's, for
consistency. (DLR)
* twice in succession with no statusbar changes to see a match
* list. */
if (common_len != *place) {
- size_t buflen = strlen(buf);
+ size_t buf_len = strlen(buf);
*lastwastab = FALSE;
- buf = charealloc(buf, common_len + buflen - *place + 1);
+ buf = charealloc(buf, common_len + buf_len - *place + 1);
charmove(buf + common_len, buf + *place,
- buflen - *place + 1);
+ buf_len - *place + 1);
charcpy(buf, mzero, common_len);
*place = common_len;
} else if (*lastwastab == FALSE || num_matches < 2)
wmove(edit, 0, 0);
{
- int foo_len = mb_cur_max() * 7;
+ size_t foo_len = mb_cur_max() * 7;
char *foo = charalloc(foo_len + 1);
for (; j < numents && editline <= editwinrows - 1; j++) {
/* Aha! It's a symlink! Now, is it a dir? If so,
* mark it as such. */
if (stat(filelist[j], &st) == 0 &&
- S_ISDIR(st.st_mode)) {
- charcpy(foo, _("(dir)"), foo_len);
- foo[foo_len] = '\0';
- } else
+ S_ISDIR(st.st_mode))
+ strncpy(foo, _("(dir)"), foo_len);
+ else
strcpy(foo, "--");
- } else if (S_ISDIR(st.st_mode)) {
- charcpy(foo, _("(dir)"), foo_len);
- foo[foo_len] = '\0';
- } else if (st.st_size < (1 << 10)) /* less than 1 k. */
+ } else if (S_ISDIR(st.st_mode))
+ strncpy(foo, _("(dir)"), foo_len);
+ else if (st.st_size < (1 << 10)) /* less than 1 k. */
sprintf(foo, "%4u B", (unsigned int)st.st_size);
else if (st.st_size < (1 << 20)) /* less than 1 meg. */
sprintf(foo, "%4u KB",
* subexpressions \1 to \9 in the replaced text). */
const char *c = last_replace;
- int search_match_count = regmatches[0].rm_eo - regmatches[0].rm_so;
- int new_size = strlen(current->data) + 1 - search_match_count;
+ size_t search_match_count =
+ regmatches[0].rm_eo - regmatches[0].rm_so;
+ size_t new_line_size =
+ strlen(current->data) + 1 - search_match_count;
/* Iterate through the replacement text to handle subexpression
* replacement using \1, \2, \3, etc. */
c++;
new_size++;
} else {
- int i = regmatches[num].rm_eo - regmatches[num].rm_so;
+ size_t i = regmatches[num].rm_eo - regmatches[num].rm_so;
/* Skip over the replacement expression. */
c += 2;
if (create)
*string = '\0';
- return new_size;
+ return new_line_size;
}
#endif
free(dest);
dest = charalloc(n);
- charcpy(dest, src, n);
+ strncpy(dest, src, n);
return dest;
}