diff options
author | 2018-09-21 20:05:39 +1000 | |
---|---|---|
committer | 2018-09-21 20:05:39 +1000 | |
commit | 0798fadff2f2f74a7efd7c14c55737bac19de954 (patch) | |
tree | 86e1ab4983fec3586a8bbb0044216216e22cc1cb /common/readline.c | |
parent | Fix segfault in output_render (diff) | |
parent | Merge pull request #2671 from emersion/output-execute-no-focus (diff) | |
download | sway-0798fadff2f2f74a7efd7c14c55737bac19de954.tar.gz sway-0798fadff2f2f74a7efd7c14c55737bac19de954.tar.zst sway-0798fadff2f2f74a7efd7c14c55737bac19de954.zip |
Merge branch 'master' into render-output-segfault
Diffstat (limited to 'common/readline.c')
-rw-r--r-- | common/readline.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/common/readline.c b/common/readline.c index a2c69018..58652429 100644 --- a/common/readline.c +++ b/common/readline.c | |||
@@ -70,28 +70,3 @@ char *peek_line(FILE *file, int line_offset, long *position) { | |||
70 | fseek(file, pos, SEEK_SET); | 70 | fseek(file, pos, SEEK_SET); |
71 | return line; | 71 | return line; |
72 | } | 72 | } |
73 | |||
74 | char *read_line_buffer(FILE *file, char *string, size_t string_len) { | ||
75 | size_t length = 0; | ||
76 | if (!string) { | ||
77 | return NULL; | ||
78 | } | ||
79 | while (1) { | ||
80 | int c = getc(file); | ||
81 | if (c == EOF || c == '\n' || c == '\0') { | ||
82 | break; | ||
83 | } | ||
84 | if (c == '\r') { | ||
85 | continue; | ||
86 | } | ||
87 | string[length++] = c; | ||
88 | if (string_len <= length) { | ||
89 | return NULL; | ||
90 | } | ||
91 | } | ||
92 | if (length + 1 == string_len) { | ||
93 | return NULL; | ||
94 | } | ||
95 | string[length] = '\0'; | ||
96 | return string; | ||
97 | } | ||