Skip to content

Commit

Permalink
lib: replace xbps_entry_is_a_conf_file with XBPS_FILE_CONF flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Duncaen committed Jan 11, 2024
1 parent 2dedfd1 commit b1831a6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
1 change: 0 additions & 1 deletion include/xbps_api_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 0 additions & 24 deletions lib/package_config_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
6 changes: 1 addition & 5 deletions lib/package_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1831a6

Please sign in to comment.