Download raw body.
histedit_parse_list: avoid needless free(line)
Don't need to free(line) at every iteration, getline(3) allows to
re-use the storage safely (since it tracks linesize too.) It
simplifies a bit the code.
ok?
diff /home/op/w/got
commit - 47cb6f8b62ed4ad39838a5d4702f593b23d3e7f2
path + /home/op/w/got
blob - 444d5de08500b51329793ef39b77c389e8f53995
file + got/got.c
--- got/got.c
+++ got/got.c
@@ -11766,11 +11766,8 @@ histedit_parse_list(struct got_histedit_list *histedit
p = line;
while (isspace((unsigned char)p[0]))
p++;
- if (p[0] == '#' || p[0] == '\0') {
- free(line);
- line = NULL;
+ if (p[0] == '#' || p[0] == '\0')
continue;
- }
cmd = NULL;
for (i = 0; i < nitems(got_histedit_cmds); i++) {
cmd = &got_histedit_cmds[i];
@@ -11807,8 +11804,6 @@ histedit_parse_list(struct got_histedit_list *histedit
break;
}
}
- free(line);
- line = NULL;
lastcmd = cmd->code;
continue;
} else {
@@ -11833,8 +11828,6 @@ histedit_parse_list(struct got_histedit_list *histedit
hle->commit_id = commit_id;
hle->logmsg = NULL;
commit_id = NULL;
- free(line);
- line = NULL;
TAILQ_INSERT_TAIL(histedit_cmds, hle, entry);
lastcmd = cmd->code;
}
histedit_parse_list: avoid needless free(line)