Skip to content

Commit

Permalink
Change pkgpair_print to pkgpair_print_color
Browse files Browse the repository at this point in the history
pkgpair_print is removed from hashdb.c and hashdb.h. In turn, a static,
colorized version of the same function is introduced in query.c as it is only
used by --list-aur

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
  • Loading branch information
yanhan committed Jun 28, 2011
1 parent 632a629 commit be9faff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 0 additions & 6 deletions hashdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ int pkgpair_cmp(const void *a, const void *b)
return strcmp(pair1->pkgname, pair2->pkgname);
}

void pkgpair_print(void *pkg)
{
struct pkgpair *pkgpair_ptr = pkg;
printf("%s\n", pkgpair_ptr->pkgname);
}

void *provides_search(void *htable, void *val)
{
struct hash_table *hash = htable;
Expand Down
1 change: 0 additions & 1 deletion hashdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct pkgpair {

unsigned long pkgpair_sdbm(void *pkg);
int pkgpair_cmp(const void *a, const void *b);
void pkgpair_print(void *pkg);

/* Searches htable for given package val
* Provided to hashbst_tree_search */
Expand Down
9 changes: 8 additions & 1 deletion query.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,13 @@ int powaur_crawl(alpm_list_t *targets)
return ret;
}

void pkgpair_print_color(void *p)
{
struct pkgpair *pkgpair_ptr = p;
printf("%s%s%s %s%s%s\n", color.bold, pkgpair_ptr->pkgname, color.nocolor,
color.bgreen, alpm_pkg_get_version(pkgpair_ptr->pkg), color.nocolor);
}

int powaur_list_aur(void)
{
struct pw_hashdb *hashdb = build_hashdb();
Expand All @@ -609,7 +616,7 @@ int powaur_list_aur(void)
return -1;
}

hash_walk(hashdb->aur, pkgpair_print);
hash_walk(hashdb->aur, pkgpair_print_color);
hashdb_free(hashdb);
return 0;
}

0 comments on commit be9faff

Please sign in to comment.