From b1831a663198410fa141ef441044a7ddfb3191d0 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Thu, 11 Jan 2024 15:35:12 +0100 Subject: [PATCH] lib: replace xbps_entry_is_a_conf_file with XBPS_FILE_CONF flag --- include/xbps_api_impl.h | 1 - lib/package_config_files.c | 24 ------------------------ lib/package_unpack.c | 6 +----- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/include/xbps_api_impl.h b/include/xbps_api_impl.h index a93c6af1..5b12398c 100644 --- a/include/xbps_api_impl.h +++ b/include/xbps_api_impl.h @@ -84,7 +84,6 @@ bool HIDDEN xbps_remove_pkg_from_array_by_pkgver(xbps_array_t, const char *); void HIDDEN xbps_fetch_set_cache_connection(int, int); void HIDDEN xbps_fetch_unset_cache_connection(void); int HIDDEN xbps_cb_message(struct xbps_handle *, xbps_dictionary_t, const char *); -int HIDDEN xbps_entry_is_a_conf_file(xbps_dictionary_t, const char *); int HIDDEN xbps_entry_install_conf_file(struct xbps_handle *, xbps_dictionary_t, xbps_dictionary_t, struct archive_entry *, const char *, const char *, bool); diff --git a/lib/package_config_files.c b/lib/package_config_files.c index ea089866..a2b759c7 100644 --- a/lib/package_config_files.c +++ b/lib/package_config_files.c @@ -33,30 +33,6 @@ #include "xbps_api_impl.h" -/* - * Returns true if entry is a configuration file, false otherwise. - */ -int HIDDEN -xbps_entry_is_a_conf_file(xbps_dictionary_t filesd, - const char *entry_pname) -{ - xbps_array_t array; - xbps_dictionary_t d; - const char *cffile; - - array = xbps_dictionary_get(filesd, "conf_files"); - if (xbps_array_count(array) == 0) - return false; - - for (unsigned int i = 0; i < xbps_array_count(array); i++) { - d = xbps_array_get(array, i); - xbps_dictionary_get_cstring_nocopy(d, "file", &cffile); - if (strcmp(cffile, entry_pname) == 0) - return true; - } - return false; -} - /* * Returns 1 if entry should be installed, 0 if don't or -1 on error. */ diff --git a/lib/package_unpack.c b/lib/package_unpack.c index c0b5ac44..e9cb8685 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -304,11 +304,7 @@ unpack_archive(struct xbps_handle *xhp, * Check if current entry is a configuration file, * that should be kept. */ - if (!force && (entry_type == AE_IFREG)) { - buf = strchr(entry_pname, '.') + 1; - assert(buf != NULL); - keep_conf_file = xbps_entry_is_a_conf_file(binpkg_filesd, buf); - } + keep_conf_file = (file->flags & XBPS_FILE_CONF) != 0; /* * If file to be extracted does not match the file type of