Skip to content

Commit

Permalink
Remove redundant line when chsrc_append_to_file()
Browse files Browse the repository at this point in the history
  • Loading branch information
ccmywish committed Nov 21, 2024
1 parent c3587ed commit f2d8997
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/framework/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,9 +1118,7 @@ chsrc_ensure_dir (const char *dir)
chsrc_note2 (xy_2strjoin (msg, dir));
}

/**
* @note 为了方便维护,该函数还会额外给要写入的字符串添加一个换行符
*/

static void
chsrc_append_to_file (const char *str, const char *filename)
{
Expand All @@ -1142,11 +1140,9 @@ chsrc_append_to_file (const char *str, const char *filename)
exit (Exit_UserCause);
}

char *newstr = xy_2strjoin (str, "\n");

size_t len = strlen (newstr);
size_t len = strlen (str);

size_t ret = fwrite (newstr, len, 1, f);
size_t ret = fwrite (str, len, 1, f);
if (ret != 1)
{
char *msg = CliOpt_InEnglish ? xy_2strjoin ("Write failed to ", file)
Expand Down

0 comments on commit f2d8997

Please sign in to comment.