- utils.c:
num_of_digits()
- Use a size_t instead of an int, and rename to digits(). (DLR)
+ align()
+ - Rename variable strp to str for consistency. (DLR)
- winio.c:
do_statusbar_output()
- Don't set answer_len until after it's been asserted that
for len plus a trailing multibyte character and/or tab. (DLR)
- Don't check for multicolumn characters if the NO_UTF8 flag
isn't set. (DLR)
+ - Free buf_mb when we're done using it. (DLR)
nanogetstr()
- Rename variable def to curranswer to avoid confusion. (DLR)
- Only declare and use the tabbed variable if DISABLE_TABCOMP
wctomb(NULL, 0);
*chr_mb_len = 0;
}
+
+ align(&chr_mb);
} else {
#endif
*chr_mb_len = 1;
- chr_mb = charalloc(1);
- *chr_mb = (char)chr;
+ chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
#ifdef NANO_WIDE
}
#endif
if (width == 0)
width = filecols;
}
+
wmove(edit, editline, col);
}
free(help_ptr);
}
+
ptr += sprintf(ptr, "\n");
}
* line. */
if (!is_word_mbchar(char_mb))
break;
+
/* If we haven't found it, then we've started on a word, so set
* started_on_word to TRUE. */
- else
- started_on_word = TRUE;
+ started_on_word = TRUE;
current_x += char_mb_len;
}
int mbwidth(const char *c);
int mb_cur_max(void);
char *make_mbchar(int chr, int *chr_mb_len);
-#if defined(ENABLE_NANORC) || defined(ENABLE_EXTRA)
+#if defined(ENABLE_NANORC) || defined(NANO_EXTRA)
char *make_mbstring(const char *str);
#endif
int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
void get_homedir(void);
bool parse_num(const char *str, ssize_t *val);
bool parse_line_column(const char *str, int *line, ssize_t *column);
-void align(char **strp);
+void align(char **str);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
}
/* Fix the memory allocation for a string. */
-void align(char **strp)
+void align(char **str)
{
- assert(strp != NULL);
+ assert(str != NULL);
- if (*strp != NULL)
- *strp = charealloc(*strp, strlen(*strp) + 1);
+ if (*str != NULL)
+ *str = charealloc(*str, strlen(*str) + 1);
}
/* Null a string at a certain index and align it. */
start_index += buf_mb_len;
}
+ free(buf_mb);
+
if (index < alloc_len - 1)
converted[index] = '\0';