Remove redundant line when chsrc_append_to_file()

This commit is contained in:
Aoran Zeng 2024-11-22 02:40:17 +08:00
parent c3587edfae
commit f2d8997909
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -1118,9 +1118,7 @@ chsrc_ensure_dir (const char *dir)
chsrc_note2 (xy_2strjoin (msg, dir)); chsrc_note2 (xy_2strjoin (msg, dir));
} }
/**
* @note 便
*/
static void static void
chsrc_append_to_file (const char *str, const char *filename) chsrc_append_to_file (const char *str, const char *filename)
{ {
@ -1142,11 +1140,9 @@ chsrc_append_to_file (const char *str, const char *filename)
exit (Exit_UserCause); exit (Exit_UserCause);
} }
char *newstr = xy_2strjoin (str, "\n"); size_t len = strlen (str);
size_t len = strlen (newstr); size_t ret = fwrite (str, len, 1, f);
size_t ret = fwrite (newstr, len, 1, f);
if (ret != 1) if (ret != 1)
{ {
char *msg = CliOpt_InEnglish ? xy_2strjoin ("Write failed to ", file) char *msg = CliOpt_InEnglish ? xy_2strjoin ("Write failed to ", file)