parse: s/strtok_r()/lxc_iterate_parts()/g

parent 803fd7bf
...@@ -68,10 +68,9 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, ...@@ -68,10 +68,9 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
void *data) void *data)
{ {
int fd; int fd;
char *buf, *chop, *line; char *buf, *line;
struct stat st; struct stat st;
int ret = 0; int ret = 0;
char *saveptr = NULL;
fd = open(file, O_RDONLY | O_CLOEXEC); fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd < 0) if (fd < 0)
...@@ -94,7 +93,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, ...@@ -94,7 +93,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback,
return -1; 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); ret = callback(line, data);
if (ret) { if (ret) {
/* Callback rv > 0 means stop here callback rv < 0 means /* Callback rv > 0 means stop here callback rv < 0 means
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment