aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/gensquashfs/src/mkfs.h1
-rw-r--r--include/fstree.h1
-rw-r--r--include/io/dir_iterator.h2
-rw-r--r--include/io/mem.h2
-rw-r--r--include/io/std.h2
-rw-r--r--include/io/xfrm.h2
-rw-r--r--include/tar/tar.h1
-rw-r--r--include/util/parse.h (renamed from include/io/istream.h)10
-rw-r--r--lib/io/Makemodule.am11
-rw-r--r--lib/io/src/internal.h1
-rw-r--r--lib/util/Makemodule.am10
-rw-r--r--lib/util/src/get_line.c (renamed from lib/io/src/get_line.c)13
-rw-r--r--lib/util/test/get_line.c (renamed from lib/io/test/get_line.c)1
-rw-r--r--lib/util/test/str_table.c2
14 files changed, 31 insertions, 28 deletions
diff --git a/bin/gensquashfs/src/mkfs.h b/bin/gensquashfs/src/mkfs.h
index fd6de7f..9edd004 100644
--- a/bin/gensquashfs/src/mkfs.h
+++ b/bin/gensquashfs/src/mkfs.h
@@ -13,6 +13,7 @@
#include "common.h"
#include "io/dir_iterator.h"
#include "util/util.h"
+#include "util/parse.h"
#ifdef HAVE_SYS_XATTR_H
#include <sys/xattr.h>
diff --git a/include/fstree.h b/include/fstree.h
index 779cd28..3c3782e 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -16,7 +16,6 @@
#include "sqfs/predef.h"
#include "io/dir_entry.h"
-#include "io/istream.h"
#include "compat.h"
typedef struct fstree_defaults_t fstree_defaults_t;
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index 152eb93..1ea3321 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -8,7 +8,7 @@
#define IO_DIR_ITERATOR_H
#include "io/dir_entry.h"
-#include "io/istream.h"
+#include "sqfs/predef.h"
/**
* @interface dir_iterator_t
diff --git a/include/io/mem.h b/include/io/mem.h
index c848ef0..20b04ab 100644
--- a/include/io/mem.h
+++ b/include/io/mem.h
@@ -7,7 +7,7 @@
#ifndef IO_MEM_STREAM_H
#define IO_MEM_STREAM_H
-#include "io/istream.h"
+#include "sqfs/predef.h"
#ifdef __cplusplus
extern "C" {
diff --git a/include/io/std.h b/include/io/std.h
index c5dddfa..a9f436a 100644
--- a/include/io/std.h
+++ b/include/io/std.h
@@ -7,7 +7,7 @@
#ifndef IO_STD_H
#define IO_STD_H
-#include "io/istream.h"
+#include "sqfs/io.h"
#ifdef __cplusplus
extern "C" {
diff --git a/include/io/xfrm.h b/include/io/xfrm.h
index f0ff1ce..21ffa57 100644
--- a/include/io/xfrm.h
+++ b/include/io/xfrm.h
@@ -7,7 +7,7 @@
#ifndef IO_XFRM_H
#define IO_XFRM_H
-#include "io/istream.h"
+#include "sqfs/predef.h"
#include "xfrm/stream.h"
#ifdef __cplusplus
diff --git a/include/tar/tar.h b/include/tar/tar.h
index 1f1b1b4..52a0562 100644
--- a/include/tar/tar.h
+++ b/include/tar/tar.h
@@ -9,7 +9,6 @@
#include "config.h"
#include "compat.h"
-#include "io/istream.h"
#include "io/dir_iterator.h"
#include "sqfs/io.h"
diff --git a/include/io/istream.h b/include/util/parse.h
index f41be2e..bc635ad 100644
--- a/include/io/istream.h
+++ b/include/util/parse.h
@@ -1,11 +1,11 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
- * istream.h
+ * parse.h
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#ifndef IO_ISTREAM_H
-#define IO_ISTREAM_H
+#ifndef UTIL_PARSE_H
+#define UTIL_PARSE_H
#include "sqfs/predef.h"
@@ -52,4 +52,4 @@ SQFS_INTERNAL int istream_get_line(sqfs_istream_t *strm, char **out,
}
#endif
-#endif /* IO_ISTREAM_H */
+#endif /* UTIL_PARSE_H */
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am
index 4f2c180..732c15b 100644
--- a/lib/io/Makemodule.am
+++ b/lib/io/Makemodule.am
@@ -1,7 +1,6 @@
-libio_a_SOURCES = include/io/istream.h include/io/xfrm.h \
- include/io/std.h include/io/dir_entry.h \
+libio_a_SOURCES = include/io/xfrm.h include/io/std.h include/io/dir_entry.h \
include/io/dir_iterator.h include/io/mem.h lib/io/src/internal.h \
- lib/io/src/get_line.c lib/io/src/xfrm/ostream.c \
+ lib/io/src/xfrm/ostream.c \
lib/io/src/xfrm/istream.c lib/io/src/dir_tree_iterator.c \
lib/io/src/dir_entry.c lib/io/src/mem.c lib/io/src/std.c
libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS)
@@ -16,17 +15,13 @@ endif
noinst_LIBRARIES += libio.a
-LIBIO_TESTS = test_istream_mem test_get_line test_dir_iterator \
+LIBIO_TESTS = test_istream_mem test_dir_iterator \
test_dir_tree_iterator test_dir_tree_iterator2 test_dir_tree_iterator3
test_istream_mem_SOURCES = lib/io/test/istream_mem.c
test_istream_mem_LDADD = libio.a libcompat.a
test_istream_mem_CPPFLAGS = $(AM_CPPFLAGS)
-test_get_line_SOURCES = lib/io/test/get_line.c
-test_get_line_LDADD = libio.a libcompat.a
-test_get_line_CPPFLAGS = $(AM_CPPFLAGS)
-
test_dir_iterator_SOURCES = lib/io/test/dir_iterator.c
test_dir_iterator_LDADD = libio.a libutil.a libcompat.a
test_dir_iterator_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/lib/io/src/internal.h b/lib/io/src/internal.h
index a618ed3..e9804b9 100644
--- a/lib/io/src/internal.h
+++ b/lib/io/src/internal.h
@@ -9,7 +9,6 @@
#include "config.h"
#include "compat.h"
-#include "io/istream.h"
#include "io/xfrm.h"
#include "io/std.h"
#include "xfrm/compress.h"
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index a797930..1ca4802 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -1,6 +1,6 @@
libutil_a_SOURCES = include/util/util.h include/util/str_table.h \
include/util/hash_table.h include/util/test.h include/util/rbtree.h \
- include/util/array.h include/util/threadpool.h \
+ include/util/array.h include/util/threadpool.h include/util/parse.h \
include/util/w32threadwrap.h include/util/mempool.h \
lib/util/src/str_table.c lib/util/src/alloc.c lib/util/src/rbtree.c \
lib/util/src/array.c lib/util/src/xxhash.c lib/util/src/hash_table.c \
@@ -8,7 +8,8 @@ libutil_a_SOURCES = include/util/util.h include/util/str_table.h \
lib/util/src/is_memory_zero.c lib/util/src/mkdir_p.c \
lib/util/src/canonicalize_name.c lib/util/src/filename_sane.c \
lib/util/src/source_date_epoch.c lib/util/src/file_cmp.c \
- lib/util/src/hex_decode.c lib/util/src/base64_decode.c
+ lib/util/src/hex_decode.c lib/util/src/base64_decode.c \
+ lib/util/src/get_line.c
libutil_a_CFLAGS = $(AM_CFLAGS)
libutil_a_CPPFLAGS = $(AM_CPPFLAGS)
@@ -76,10 +77,13 @@ test_hex_decode_LDADD = libutil.a libcompat.a
test_base64_decode_SOURCES = lib/util/test/base64_decode.c
test_base64_decode_LDADD = libutil.a libcompat.a
+test_get_line_SOURCES = lib/util/test/get_line.c
+test_get_line_LDADD = libutil.a libio.a libcompat.a
+
LIBUTIL_TESTS = \
test_str_table test_rbtree test_xxhash test_threadpool test_ismemzero \
test_canonicalize_name test_filename_sane test_filename_sane_w32 \
- test_sdate_epoch test_hex_decode test_base64_decode
+ test_sdate_epoch test_hex_decode test_base64_decode test_get_line
check_PROGRAMS += $(LIBUTIL_TESTS)
TESTS += $(LIBUTIL_TESTS)
diff --git a/lib/io/src/get_line.c b/lib/util/src/get_line.c
index 3178592..5a17b62 100644
--- a/lib/io/src/get_line.c
+++ b/lib/util/src/get_line.c
@@ -1,12 +1,17 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* get_line.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "internal.h"
+#include "util/parse.h"
#include "sqfs/io.h"
#include "sqfs/error.h"
+#include "compat.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
static void ltrim(char *buffer)
{
@@ -112,10 +117,10 @@ int istream_get_line(sqfs_istream_t *strm, char **out,
*out = line;
return 0;
fail: {
- int temp = errno;
+ os_error_t temp = get_os_error_state();
free(line);
*out = NULL;
- errno = temp;
+ set_os_error_state(temp);
return err;
}
out_eof:
diff --git a/lib/io/test/get_line.c b/lib/util/test/get_line.c
index d300a3a..6189d31 100644
--- a/lib/io/test/get_line.c
+++ b/lib/util/test/get_line.c
@@ -4,6 +4,7 @@
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
+#include "util/parse.h"
#include "io/mem.h"
#include "util/test.h"
diff --git a/lib/util/test/str_table.c b/lib/util/test/str_table.c
index b146773..153d09e 100644
--- a/lib/util/test/str_table.c
+++ b/lib/util/test/str_table.c
@@ -7,8 +7,8 @@
#include "config.h"
#include "util/str_table.h"
+#include "util/parse.h"
#include "compat.h"
-#include "io/istream.h"
#include "util/test.h"
#include "sqfs/io.h"