summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormorganamilo <morganamilo@gmail.com>2019-11-06 01:37:26 +0100
committerAllan McRae <allan@archlinux.org>2019-11-07 12:43:15 +0100
commit94982d0061890529cc22401b6763fb5e9ef4e7d1 (patch)
tree21f14abd775aabe19414f6d4713db849b6597cb7 /src
parent1df22d3242a5db640a83124402249d34ac2e61e9 (diff)
downloadpacman-94982d0061890529cc22401b6763fb5e9ef4e7d1.tar.gz
pacman-94982d0061890529cc22401b6763fb5e9ef4e7d1.tar.xz
pacman: make exact_file an int
We only ever use it as a bool, no need to pass a char* around. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/files.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pacman/files.c b/src/pacman/files.c
index 19191dd8..3b6dc23b 100644
--- a/src/pacman/files.c
+++ b/src/pacman/files.c
@@ -58,7 +58,7 @@ static void print_owned_by(alpm_db_t *db, alpm_pkg_t *pkg, char *filename)
alpm_pkg_get_version(pkg), colstr->nocolor);
}
-static void print_match(alpm_list_t *match, alpm_db_t *repo, alpm_pkg_t *pkg, char *exact_file)
+static void print_match(alpm_list_t *match, alpm_db_t *repo, alpm_pkg_t *pkg, int exact_file)
{
alpm_db_t *db_local = alpm_get_localdb(config->handle);
const colstr_t *colstr = &config->colstr;
@@ -71,7 +71,7 @@ static void print_match(alpm_list_t *match, alpm_db_t *repo, alpm_pkg_t *pkg, ch
}
} else if(config->quiet) {
printf("%s/%s\n", alpm_db_get_name(repo), alpm_pkg_get_name(pkg));
- } else if(exact_file != NULL) {
+ } else if(exact_file) {
alpm_list_t *ml;
for(ml = match; ml; ml = alpm_list_next(ml)) {
char *filename = ml->data;
@@ -104,9 +104,9 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
int found = 0;
regex_t reg;
size_t len = strlen(targ);
- char *exact_file = strchr(targ, '/');
+ int exact_file = strchr(targ, '/') != NULL;
- if(exact_file != NULL) {
+ if(exact_file) {
while(len > 1 && targ[0] == '/') {
targ++;
len--;
@@ -131,7 +131,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
alpm_filelist_t *files = alpm_pkg_get_files(pkg);
alpm_list_t *match = NULL;
- if(exact_file != NULL) {
+ if(exact_file) {
if (regex) {
for(size_t f = 0; f < files->count; f++) {
char *c = files->files[f].name;