mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-12-27 05:40:17 +05:30
C: pure_getline.c: remove string reallocation
This commit is contained in:
parent
d1026e247c
commit
f9985a55ce
@ -26,15 +26,6 @@ bool pure_getline(char** output) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char* new_line = realloc(line, (len + 1) * sizeof(char));
|
||||
|
||||
if (new_line == NULL) {
|
||||
*output = line;
|
||||
return false;
|
||||
}
|
||||
|
||||
line = new_line;
|
||||
|
||||
if (character == '\n') {
|
||||
line[len] = '\0';
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user