* src/winio.c (edit_draw): When the whole line has been coloured,
don't bother looking for any more starts. This prevents some lines
from being erroneously marked as CENDAFTER instead of CWHOLELINE.
+ * src/*.c: Don't check for non-NULL before freeing; it's unneeded.
2015-06-11 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (get_key_buffer): Add some debugging code to make it
/* If we can't open the path, get out. */
if (dir == NULL) {
- if (path != NULL)
- free(path);
+ free(path);
beep();
return NULL;
}
interface_color_pair[i].pairnum = A_NORMAL;
}
- if (specified_color_combo[i] != NULL) {
- free(specified_color_combo[i]);
- specified_color_combo[i] = NULL;
- }
+ free(specified_color_combo[i]);
+ specified_color_combo[i] = NULL;
}
for (; this_syntax != NULL; this_syntax = this_syntax->next) {
/* Move fileptr back one line and blow away the old fileptr,
* since its text has been saved. */
fileptr = fileptr->prev;
- if (fileptr != NULL) {
- if (fileptr->next != NULL)
- free(fileptr->next);
- }
+ if (fileptr != NULL)
+ free(fileptr->next);
}
/* Attach the line at current after the line at fileptr. */
}
/* Free d_there_file, since we're done using it. */
- if (d_there_file != NULL)
- free(d_there_file);
+ free(d_there_file);
return d_there;
}
cleanup_and_exit:
free(realname);
- if (tempname != NULL)
- free(tempname);
+ free(tempname);
return retval;
}
* string's real length. */
unsunder(answer, answer_len);
- if (full_filename != NULL)
- free(full_filename);
- if (full_answer != NULL)
- free(full_answer);
+ free(full_filename);
+ free(full_answer);
if (do_warning) {
/* If we're using restricted mode, we aren't allowed
delwin(bottomwin);
#ifndef DISABLE_JUSTIFY
- if (quotestr != NULL)
- free(quotestr);
+ free(quotestr);
#ifdef HAVE_REGEX_H
regfree("ereg);
- if (quoteerr != NULL)
- free(quoteerr);
+ free(quoteerr);
#endif
#endif
#ifndef NANO_TINY
- if (backup_dir != NULL)
- free(backup_dir);
+ free(backup_dir);
#endif
#ifndef DISABLE_OPERATINGDIR
- if (operating_dir != NULL)
- free(operating_dir);
- if (full_operating_dir != NULL)
- free(full_operating_dir);
+ free(operating_dir);
+ free(full_operating_dir);
#endif
+ free(answer);
free(last_search);
free(last_replace);
#ifndef DISABLE_SPELLER
- if (alt_speller != NULL)
- free(alt_speller);
+ free(alt_speller);
#endif
- if (answer != NULL)
- free(answer);
if (cutbuffer != NULL)
free_filestruct(cutbuffer);
#ifndef DISABLE_JUSTIFY
if (openfile != NULL)
free_openfilestruct(openfile);
#ifndef DISABLE_COLOR
- if (syntaxstr != NULL)
- free(syntaxstr);
+ free(syntaxstr);
while (syntaxes != NULL) {
syntaxtype *bill = syntaxes;
free(s);
}
#ifndef DISABLE_NANORC
- if (homedir != NULL)
- free(homedir);
+ free(homedir);
#endif
}
/* help_text has been freed and set to NULL unless the user resized
* while in the help screen. */
- if (help_text != NULL)
- free(help_text);
+ free(help_text);
/* Allocate space for the help text. */
help_text = charalloc(allocsize + 1);
{
assert(fileptr != NULL && fileptr->data != NULL);
- if (fileptr->data != NULL)
- free(fileptr->data);
-
+ free(fileptr->data);
#ifndef DISABLE_COLOR
- if (fileptr->multidata)
- free(fileptr->multidata);
+ free(fileptr->multidata);
#endif
-
free(fileptr);
}
free(fileptr->filename);
free_filestruct(fileptr->fileage);
#ifndef NANO_TINY
- if (fileptr->current_stat != NULL)
- free(fileptr->current_stat);
+ free(fileptr->current_stat);
#endif
-
free(fileptr);
}
if (history_list != NULL) {
history_reset(*history_list);
- if (magichistory != NULL)
- free(magichistory);
+ free(magichistory);
}
#endif
/* prompt has been freed and set to NULL unless the user resized
* while at the statusbar prompt. */
- if (prompt != NULL)
- free(prompt);
+ free(prompt);
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
return;
}
- if (endsyntax->linter != NULL)
- free(endsyntax->linter);
+ free(endsyntax->linter);
/* Let them unset the linter by using "". */
if (!strcmp(ptr, "\"\""))
return;
}
- if (endsyntax->formatter != NULL)
- free(endsyntax->formatter);
+ free(endsyntax->formatter);
/* Let them unset the formatter by using "". */
if (!strcmp(ptr, "\"\""))
while (fs->undotop != NULL && fs->undotop != fs->current_undo) {
undo *u2 = fs->undotop;
fs->undotop = fs->undotop->next;
- if (u2->strdata != NULL)
- free(u2->strdata);
+ free(u2->strdata);
if (u2->cutbuffer)
free_filestruct(u2->cutbuffer);
free(u2);