]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Move la_getline into libarchive_fe
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 9 Mar 2026 20:28:00 +0000 (21:28 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 16 Mar 2026 08:43:45 +0000 (09:43 +0100)
This allows easier reuse of the getline implementation in other tools
like cpio (in upcoming commit).

Makefile.am
contrib/android/Android.mk
libarchive_fe/lafe_getline.c [moved from unzip/la_getline.c with 85% similarity]
libarchive_fe/lafe_getline.h [moved from unzip/la_getline.h with 52% similarity]
unzip/CMakeLists.txt
unzip/bsdunzip.c

index b6bf548249cc98a3fade194f3309b94faecc6607..fe3b8814e0658ed16a20f2f42afde960f9d68c43 100644 (file)
@@ -1089,11 +1089,13 @@ libarchive_test_EXTRA_DIST=\
 #
 noinst_HEADERS+= \
        libarchive_fe/lafe_err.h \
+       libarchive_fe/lafe_getline.h \
        libarchive_fe/lafe_platform.h \
        libarchive_fe/line_reader.h \
        libarchive_fe/passphrase.h
 libarchive_fe_la_SOURCES= \
        libarchive_fe/lafe_err.c \
+       libarchive_fe/lafe_getline.c \
        libarchive_fe/line_reader.c \
        libarchive_fe/passphrase.c
 
@@ -1557,12 +1559,10 @@ bsdcat_test_EXTRA_DIST= \
 noinst_HEADERS+= \
        unzip/bsdunzip.h \
        unzip/bsdunzip_platform.h \
-       unzip/la_getline.h \
        unzip/la_queue.h
 bsdunzip_SOURCES= \
        unzip/bsdunzip.c \
-       unzip/cmdline.c \
-       unzip/la_getline.c
+       unzip/cmdline.c
 
 if INC_WINDOWS_FILES
 noinst_HEADERS+=
index 20e46a699643aee601806c91cf613842c41d85e6..1fdd2bf7cf352ec96cd2a2be886f1b656ad4b4e5 100644 (file)
@@ -159,6 +159,7 @@ libarchive_host_src_files :=
 endif
 
 libarchive_fe_src_files :=  libarchive_fe/lafe_err.c \
+                                                       libarchive_fe/lafe_getline.c \
                                                        libarchive_fe/line_reader.c \
                                                        libarchive_fe/passphrase.c
 
similarity index 85%
rename from unzip/la_getline.c
rename to libarchive_fe/lafe_getline.c
index 40ab35cde8423b201e2bc64d9e70a6330c976fad..ebd9f1a894a7843db4354dfc60f0f4ebff7d0728 100644 (file)
@@ -7,12 +7,15 @@
  * All rights reserved.
  */
 
-#include "bsdunzip_platform.h"
+#include "lafe_platform.h"
 #ifndef HAVE_GETLINE
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #ifdef HAVE_STDIO_H
 #include <stdio.h>
 #endif
 #include <string.h>
 #endif
 
+#include "lafe_getline.h"
+
 static ssize_t
-la_getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
+lafe_getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
 {
        char *ptr, *eptr;
 
@@ -72,6 +77,6 @@ la_getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
 ssize_t
 getline(char **buf, size_t *bufsiz, FILE *fp)
 {
-       return la_getdelim(buf, bufsiz, '\n', fp);
+       return lafe_getdelim(buf, bufsiz, '\n', fp);
 }
 #endif
similarity index 52%
rename from unzip/la_getline.h
rename to libarchive_fe/lafe_getline.h
index d7588731943d46938b0f0877d92ef71f5749ed48..b10641ffd1ebe754c5512c32252f7593d21fc125 100644 (file)
@@ -5,12 +5,19 @@
  * All rights reserved.
  */
 
-#ifndef LA_GETLINE_H_INCLUDED
-#define LA_GETLINE_H_INCLUDED
+#ifndef LAFE_GETLINE_H_INCLUDED
+#define LAFE_GETLINE_H_INCLUDED
+
+#include "lafe_platform.h"
 
-#include <stdio.h>
 #ifndef HAVE_GETLINE
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
 ssize_t getline(char **buf, size_t *bufsiz, FILE *fp);
 #endif
 
-#endif /* !LA_GETLINE_H_INCLUDED */
+#endif /* !LAFE_GETLINE_H_INCLUDED */
index f3c62cb339c6b7e450aad3adecc7a1d56468b77f..9fe21eeebe0a2aee19b839a495a6ff517974ffb6 100644 (file)
@@ -13,11 +13,11 @@ IF(ENABLE_UNZIP)
     bsdunzip.h
     bsdunzip_platform.h
     cmdline.c
-    la_getline.c
-    la_getline.h
     la_queue.h
     ../libarchive_fe/lafe_err.c
     ../libarchive_fe/lafe_err.h
+    ../libarchive_fe/lafe_getline.c
+    ../libarchive_fe/lafe_getline.h
     ../libarchive_fe/lafe_platform.h
     ../libarchive_fe/passphrase.c
     ../libarchive_fe/passphrase.h
index a76658671a8900c121999d72be529696bf6ad6bc..aa849568ba7e80ba71b5c0756b91ec1accfd0367 100644 (file)
@@ -9,7 +9,7 @@
 #include "bsdunzip_platform.h"
 
 #include "la_queue.h"
-#include "la_getline.h"
+#include "lafe_getline.h"
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif