in ngetdelim(), do sanity checks in an assert instead of checking them

manually and returning -1 if they fail


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3232 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-11-30 19:33:56 +00:00
parent 13b6115894
commit 26ebd35d54
2 changed files with 4 additions and 2 deletions

View File

@ -224,6 +224,9 @@ CVS code -
the text of the spell-checked file into its own function, the text of the spell-checked file into its own function,
replace_buffer(). (DLR) replace_buffer(). (DLR)
- utils.c: - utils.c:
ngetdelim()
- Do sanity checks in an assert instead of checking them
manually and returning -1 if they fail. (DLR)
is_whole_word() is_whole_word()
- Only include when DISABLE_SPELLER isn't defined, as it's only - Only include when DISABLE_SPELLER isn't defined, as it's only
used then. (DLR) used then. (DLR)

View File

@ -199,8 +199,7 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
int c; int c;
/* Sanity checks. */ /* Sanity checks. */
if (lineptr == NULL || n == NULL || stream == NULL) assert(lineptr != NULL && n != NULL && stream != NULL);
return -1;
/* Allocate the line the first time. */ /* Allocate the line the first time. */
if (*lineptr == NULL) { if (*lineptr == NULL) {