]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
parse: s/strtok_r()/lxc_iterate_parts()/g
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 26 Jul 2018 14:11:43 +0000 (16:11 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 26 Jul 2018 14:38:42 +0000 (16:38 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/parse.c

index bc209347c7b022b443959620d3271766d73f472b..cd3110377535752dd056d47256ba7b7175072999 100644 (file)
@@ -68,10 +68,9 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
                                void *data)
 {
        int fd;
-       char *buf, *chop, *line;
+       char *buf, *line;
        struct stat st;
        int ret = 0;
-       char *saveptr = NULL;
 
        fd = open(file, O_RDONLY | O_CLOEXEC);
        if (fd < 0)
@@ -94,7 +93,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
                return -1;
        }
 
-       for (chop = buf; (line = strtok_r(chop, "\n\0", &saveptr)); chop = NULL) {
+       lxc_iterate_parts(line, buf, "\n\0") {
                ret = callback(line, data);
                if (ret) {
                        /* Callback rv > 0 means stop here callback rv < 0 means