diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-03-04 13:54:54 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-11 20:47:43 +0300 |
commit | 67f5a753e50da8737dc28b0ea2c2194b21d76fdd (patch) | |
tree | 657a81a529d2733eecae1837cc48ac25abe73357 /src/apk_database.h | |
parent | efb55ce650d3cac9a607560d840f95c1127e68f5 (diff) | |
download | apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.gz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.bz2 apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.tar.xz apk-tools-67f5a753e50da8737dc28b0ea2c2194b21d76fdd.zip |
db, apps: sort display results based on package names
Diffstat (limited to 'src/apk_database.h')
-rw-r--r-- | src/apk_database.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/apk_database.h b/src/apk_database.h index a0a62ca..194fe06 100644 --- a/src/apk_database.h +++ b/src/apk_database.h @@ -162,6 +162,7 @@ struct apk_database { int no_chroot : 1; int compat_newfeatures : 1; int compat_notinstallable : 1; + int sorted_names : 1; struct apk_dependency_array *world; struct apk_protected_path_array *protected_paths; @@ -175,6 +176,7 @@ struct apk_database { } repositories; struct { + struct apk_name_array *sorted_names; struct apk_hash names; struct apk_hash packages; } available; @@ -198,6 +200,10 @@ typedef union apk_database_or_void { void *ptr; } apk_database_t __attribute__ ((__transparent_union__)); +static inline int apk_name_cmp_display(const struct apk_name *a, const struct apk_name *b) { + return strcmp(a->name, b->name); +} + struct apk_name *apk_db_get_name(struct apk_database *db, apk_blob_t name); struct apk_name *apk_db_query_name(struct apk_database *db, apk_blob_t name); int apk_db_get_tag_id(struct apk_database *db, apk_blob_t tag); @@ -269,8 +275,12 @@ int apk_db_install_pkg(struct apk_database *db, struct apk_package *newpkg, apk_progress_cb cb, void *cb_ctx); -void apk_name_foreach_matching(struct apk_database *db, struct apk_string_array *filter, unsigned int match, - void (*cb)(struct apk_database *db, const char *match, struct apk_name *name, void *ctx), - void *ctx); +typedef int (*apk_db_foreach_name_cb)(struct apk_database *db, const char *match, struct apk_name *name, void *ctx); + +int apk_db_foreach_matching_name(struct apk_database *db, struct apk_string_array *filter, + apk_db_foreach_name_cb cb, void *ctx); + +int apk_db_foreach_sorted_name(struct apk_database *db, struct apk_string_array *filter, + apk_db_foreach_name_cb cb, void *ctx); #endif |