diff options
author | 2015-11-27 13:14:14 -0500 | |
---|---|---|
committer | 2015-11-27 13:14:14 -0500 | |
commit | 92de436359da8f14b7dbef5f62af959095b79d06 (patch) | |
tree | 5936173e0b278b45a58d5ea1601433d7cce1ee81 /qfile.c | |
parent | rmspace: rewrite/optimize a bit (diff) | |
download | portage-utils-92de436359da8f14b7dbef5f62af959095b79d06.tar.gz portage-utils-92de436359da8f14b7dbef5f62af959095b79d06.tar.bz2 portage-utils-92de436359da8f14b7dbef5f62af959095b79d06.zip |
use the return value of getline
This allows us to avoid calling strlen to get a value getline already
calculated. We can also pass this value on to rmspace to let it trim
space for us.
Diffstat (limited to 'qfile.c')
-rw-r--r-- | qfile.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -513,10 +513,10 @@ int qfile_main(int argc, char **argv) for (i = 0; i < qargc; ++i) free(qargv[i]); qargc = 0; - while (getline(&state.buf, &state.buflen, args_file) != -1) { - if ((p = strchr(state.buf, '\n')) != NULL) - *p = '\0'; - if (state.buf == p) + size_t linelen; + while ((linelen = getline(&state.buf, &state.buflen, args_file)) != -1) { + rmspace_len(state.buf, linelen); + if (state.buf[0] == '\0') continue; qargv[qargc] = xstrdup(state.buf); if (++qargc >= max_args) |