summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2010-09-27 19:46:15 +0000
committerJason Woodward2010-09-27 19:46:15 +0000
commit9f084687d9d054ae3c38329aed7704ec15a08b15 (patch)
tree225f9f1d5b357b35f48ce887396b5acb2d14c294
parentcf24db272cf91cb002a9f0be96aae9f32ee65e31 (diff)
downloadslapt-get-9f084687d9d054ae3c38329aed7704ec15a08b15.tar.gz
api cleanup, typedef'd old structs
-rw-r--r--ChangeLog3
-rw-r--r--doc/libslapt.3134
-rw-r--r--src/action.c46
-rw-r--r--src/configuration.c10
-rw-r--r--src/configuration.h14
-rw-r--r--src/main.c6
-rw-r--r--src/package.c138
-rw-r--r--src/package.h80
-rw-r--r--src/transaction.c18
-rw-r--r--src/transaction.h22
10 files changed, 236 insertions, 235 deletions
diff --git a/ChangeLog b/ChangeLog
index 09cba2d..63841f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
-0.10.2g Sept 18, 2010
+0.10.2g Sept 27, 2010
+ * api cleanup, typedef'd old structs
* updated el translation from George Vlahavas
* updated pt_TR translation from Sérgio Surkam
* updated fr translation from Verachten Bruno
diff --git a/doc/libslapt.3 b/doc/libslapt.3
index 1b12cf3..187aaf0 100644
--- a/doc/libslapt.3
+++ b/doc/libslapt.3
@@ -11,13 +11,13 @@ slapt_rc_config *slapt_init_config(void);
/* parse config file for sources, excludes, and working_dir*/
slapt_rc_config *config = slapt_read_rc_config("/etc/slapt-get/slapt-getrc");
/* get a list of installed packages */
-struct slapt_pkg_list *installed = slapt_get_installed_pkgs();
+slapt_pkg_list_t *installed = slapt_get_installed_pkgs();
/* parse the package data, normally using config->working_dir */
FILE *data_f = fopen("/var/slapt-get/package_data","r");
-struct slapt_pkg_list *available = slapt_parse_packages_txt(data_f);
+slapt_pkg_list_t *available = slapt_parse_packages_txt(data_f);
/* search for a package in a list via regex */
-struct slapt_pkg_list *results = slapt_search_pkg_list(installed,"[0-9]frg");
+slapt_pkg_list_t *results = slapt_search_pkg_list(installed,"[0-9]frg");
slapt_free_pkg_list(results);
/* look for a specific package */
@@ -62,7 +62,7 @@ slapt-get stores the configuration information in a \fIslapt_rc_config\fP object
.nf
typedef struct {
char working_dir[WORKINGDIR_TOKEN_LEN];
- struct slapt_source_list *sources;
+ slapt_source_list_t *sources;
slapt_list_t *exclude_list;
int (*progress_cb) (void *,double,double,double,double);
SLAPT_BOOL_T download_only;
@@ -117,18 +117,18 @@ Package sources are represented by the \fIslapt_source_t\fP type. They are crea
.fi
.sp
.TP
-The \fIstruct slapt_source_list\fP stores the package sources. Sources can be added and removed with \fIslapt_add_source\fP() and \fIslapt_remove_source\fP(). Typically, \fIslapt_rc_config->sources\fP is passed as the first argument, but it could be any pointer to a \fIstruct slapt_source_list\fP that is created by \fIslapt_init_source_list\fP().
+The \fIslapt_source_list_t\fP stores the package sources. Sources can be added and removed with \fIslapt_add_source\fP() and \fIslapt_remove_source\fP(). Typically, \fIslapt_rc_config->sources\fP is passed as the first argument, but it could be any pointer to a \fIslapt_source_list_t\fP that is created by \fIslapt_init_source_list\fP().
.sp
.nf
- struct slapt_source_list {
+ typedef struct {
slapt_source_t **src;
unsigned int count;
- };
+ } slapt_source_list_t;
.sp
-.B "struct slapt_source_list *slapt_init_source_list(void);"
-.B "void slapt_add_source(struct slapt_source_list *list, slapt_source_t *s);"
-.B "void slapt_remove_source (struct slapt_source_list *list, const char *s);"
-.B "void slapt_free_source_list(struct slapt_source_list *list);"
+.B "slapt_source_list_t *slapt_init_source_list(void);"
+.B "void slapt_add_source(slapt_source_list_t *list, slapt_source_t *s);"
+.B "void slapt_remove_source (slapt_source_list_t *list, const char *s);"
+.B "void slapt_free_source_list(slapt_source_list_t *list);"
.fi
.sp
.TP
@@ -170,15 +170,15 @@ The \fIslapt_pkg_info_t\fP object is created and freed with \fIslapt_init_pkg\fP
.fi
.sp
.TP
-Package lists are useful for grouping packages from the existing installed packages, packages available from external sources, a list of dependencies, and more. Package lists are stored within a \fIstruct slapt_pkg_list\fP.
+Package lists are useful for grouping packages from the existing installed packages, packages available from external sources, a list of dependencies, and more. Package lists are stored within a \fIslapt_pkg_list_t\fP.
.sp
.nf
- struct slapt_pkg_list {
+ typedef struct {
slapt_pkg_info_t **pkgs;
unsigned int pkg_count;
SLAPT_BOOL_T free_pkgs;
SLAPT_BOOL_T ordered;
- };
+ } slapt_pkg_list_t;
.fi
.sp
.TP
@@ -191,34 +191,34 @@ If \fIordered\fP is is set to TRUE, the list has been sorted by \fIqsort\fP().
\fIslapt_pkg_info_t\fP objects are created by \fIslapt_init_pkg_list\fP() and freed by \fIslapt_free_pkg_list\fP(). \fIslapt_add_pkg_to_pkg_list\fP() is used to add a package to a list.
.sp
.nf
-.B "struct slapt_pkg_list *slapt_init_pkg_list(void);"
-.B "void slapt_free_pkg_list(struct slapt_pkg_list *);"
-.B "void slapt_add_pkg_to_pkg_list(struct slapt_pkg_list *list, slapt_pkg_info_t *pkg);"
+.B "slapt_pkg_list_t *slapt_init_pkg_list(void);"
+.B "void slapt_free_pkg_list(slapt_pkg_list_t *);"
+.B "void slapt_add_pkg_to_pkg_list(slapt_pkg_list_t *list, slapt_pkg_info_t *pkg);"
.fi
.sp
.TP
Package lists can be parsed from PACKAGES.TXT or similar formated files (such as the working_dir/package_data file used by slapt-get) with \fIslapt_parse_packages_txt\fP(). A package list of the currently installed packages is returned by \fIslapt_get_installed_pkgs\fP(). \fIslapt_get_available_pkgs\fP() is a frontend to \fIslapt_parse_packages_txt\fP() looking for a package_data file in the current directory. All three of the following set \fIfree_pkgs\fP to TRUE.
.sp
.nf
-.B "struct slapt_pkg_list *slapt_parse_packages_txt(FILE *);"
-.B "struct slapt_pkg_list *slapt_get_available_pkgs(void);"
-.B "struct slapt_pkg_list *slapt_get_installed_pkgs(void);"
+.B "slapt_pkg_list_t *slapt_parse_packages_txt(FILE *);"
+.B "slapt_pkg_list_t *slapt_get_available_pkgs(void);"
+.B "slapt_pkg_list_t *slapt_get_installed_pkgs(void);"
.fi
.sp
.TP
-Finding a specific package in a package list is done through one of the following functions. All return \fIslapt_pkg_info_t\fP, or NULL on error, except for \fIslapt_search_pkg_list\fP() which returns a list of packages as \fIstruct slapt_pkg_list\fP.
+Finding a specific package in a package list is done through one of the following functions. All return \fIslapt_pkg_info_t\fP, or NULL on error, except for \fIslapt_search_pkg_list\fP() which returns a list of packages as \fIslapt_pkg_list_t\fP.
.sp
.nf
-.B "slapt_pkg_info_t *slapt_get_newest_pkg(struct slapt_pkg_list *,"
+.B "slapt_pkg_info_t *slapt_get_newest_pkg(slapt_pkg_list_t *,"
.B " const char *);"
-.B "slapt_pkg_info_t *slapt_get_exact_pkg(struct slapt_pkg_list *list,"
+.B "slapt_pkg_info_t *slapt_get_exact_pkg(slapt_pkg_list_t *list,"
.B " const char *name,"
.B " const char *version);"
-.B "slapt_pkg_info_t *slapt_get_pkg_by_details(struct slapt_pkg_list *list,"
+.B "slapt_pkg_info_t *slapt_get_pkg_by_details(slapt_pkg_list_t *list,"
.B " const char *name,"
.B " const char *version,"
.B " const char *location);"
-.B "struct slapt_pkg_list *slapt_search_pkg_list(struct slapt_pkg_list *list,"
+.B "slapt_pkg_list_t *slapt_search_pkg_list(slapt_pkg_list_t *list,"
.B " const char *pattern);"
.fi
.sp
@@ -241,7 +241,7 @@ Comparing package versions is done with the \fIslapt_cmp_pkgs\fP functions. It
.fi
.sp
.TP
-The following functions deal with determining package dependencies and conflicts and returning them within a package list. Some require the use of a \fIstruct slapt_pkg_err_list\fP of \fIslapt_pkg_err_t\fP objects for reporting errors on which packages failed or were missing. \fIslapt_search_pkg_err_list\fP() returns 0 if the package and error string combination does not already exist in the \fIstruct slapt_pkg_err_list\fP, or 1 if found.
+The following functions deal with determining package dependencies and conflicts and returning them within a package list. Some require the use of a \fIslapt_pkg_err_list_t\fP of \fIslapt_pkg_err_t\fP objects for reporting errors on which packages failed or were missing. \fIslapt_search_pkg_err_list\fP() returns 0 if the package and error string combination does not already exist in the \fIslapt_pkg_err_list_t\fP, or 1 if found.
.sp
.nf
typedef struct {
@@ -249,63 +249,63 @@ The following functions deal with determining package dependencies and conflicts
char *error;
} slapt_pkg_err_t;
.sp
- struct slapt_pkg_err_list {
+ typedef struct {
slapt_pkg_err_t **errs;
unsigned int err_count;
- };
+ } slapt_pkg_err_list_t;
.sp
-.B "struct slapt_pkg_err_list *slapt_init_pkg_err_list(void);"
-.B "void slapt_add_pkg_err_to_list(struct slapt_pkg_err_list *l,"
+.B "slapt_pkg_err_list_t *slapt_init_pkg_err_list(void);"
+.B "void slapt_add_pkg_err_to_list(slapt_pkg_err_list_t *l,"
.B " const char *pkg,const char *err);"
-.B "int slapt_search_pkg_err_list(struct slapt_pkg_err_list *l, const char *pkg,"
+.B "int slapt_search_pkg_err_list(slapt_pkg_err_list_t *l, const char *pkg,"
.B " const char *err);"
-.B "void slapt_free_pkg_err_list(struct slapt_pkg_err_list *l);"
+.B "void slapt_free_pkg_err_list(slapt_pkg_err_list_t *l);"
.sp
.fi
.TP
-\fIslapt_get_pkg_dependencies\fP() fills a \fIstruct slapt_pkg_list\fP of dependencies for the specified package. These dependencies are pulled from the available package list and the installed package lists. Missing and conflict errors are placed in \fIstruct slapt_pkg_err_list\fP. \fIdeps\fP, \fIconflict_err\fP, and \fImissing_err\fP are initialized if NULL. \fIslapt_get_pkg_dependencies\fP() returns 0 on success, or -1 on error.
+\fIslapt_get_pkg_dependencies\fP() fills a \fIslapt_pkg_list_t\fP of dependencies for the specified package. These dependencies are pulled from the available package list and the installed package lists. Missing and conflict errors are placed in \fIslapt_pkg_err_list_t\fP. \fIdeps\fP, \fIconflict_err\fP, and \fImissing_err\fP are initialized if NULL. \fIslapt_get_pkg_dependencies\fP() returns 0 on success, or -1 on error.
.sp
.nf
.B "int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
-.B " struct slapt_pkg_list *avail_pkgs,
-.B " struct slapt_pkg_list *installed_pkgs,
+.B " slapt_pkg_list_t *avail_pkgs,
+.B " slapt_pkg_list_t *installed_pkgs,
.B " slapt_pkg_info_t *pkg,
-.B " struct slapt_pkg_list *deps,
-.B " struct slapt_pkg_err_list *conflict_err,
-.B " struct slapt_pkg_err_list *missing_err);"
+.B " slapt_pkg_list_t *deps,
+.B " slapt_pkg_err_list_t *conflict_err,
+.B " slapt_pkg_err_list_t *missing_err);"
.sp
.fi
.TP
-\fIslapt_get_pkg_conflicts\fP() returns a \fIstruct slapt_pkg_list\fP of packages that conflict with the specified package.
+\fIslapt_get_pkg_conflicts\fP() returns a \fIslapt_pkg_list_t\fP of packages that conflict with the specified package.
.sp
.nf
-.B "struct slapt_pkg_list *"
-.B "slapt_get_pkg_conflicts(struct slapt_pkg_list *avail_pkgs,
-.B " struct slapt_pkg_list *installed_pkgs,
+.B "slapt_pkg_list_t *"
+.B "slapt_get_pkg_conflicts(slapt_pkg_list_t *avail_pkgs,
+.B " slapt_pkg_list_t *installed_pkgs,
.B " slapt_pkg_info_t *pkg);"
.sp
.fi
.TP
-\fIslapt_is_required_by\fP() returns a \fIstruct slapt_pkg_list\fP of packages that require the package specified.
+\fIslapt_is_required_by\fP() returns a \fIslapt_pkg_list_t\fP of packages that require the package specified.
.sp
.nf
-.B "struct slapt_pkg_list *"
+.B "slapt_pkg_list_t *"
.B "slapt_is_required_by(const slapt_rc_config *global_config,
-.B " struct slapt_pkg_list *avail,
-.B " struct slapt_pkg_list *installed_pkgs,
-.B " struct slapt_pkg_list *pkgs_to_install,
-.B " struct slapt_pkg_list *pkgs_to_remove,
+.B " slapt_pkg_list_t *avail,
+.B " slapt_pkg_list_t *installed_pkgs,
+.B " slapt_pkg_list_t *pkgs_to_install,
+.B " slapt_pkg_list_t *pkgs_to_remove,
.B " slapt_pkg_info_t *pkg);"
.sp
.fi
.TP
-\fIslapt_get_obsolete_pkgs\fP() returns a \fIstruct slapt_pkg_list\fP of packages that are no longer available from the current package sources.
+\fIslapt_get_obsolete_pkgs\fP() returns a \fIslapt_pkg_list_t\fP of packages that are no longer available from the current package sources.
.sp
.nf
-.B "struct slapt_pkg_list *"
+.B "slapt_pkg_list_t *"
.B " slapt_get_obsolete_pkgs ( const slapt_rc_config *global_config,"
-.B " struct slapt_pkg_list *avail_pkgs,"
-.B " struct slapt_pkg_list *installed_pkgs);"
+.B " slapt_pkg_list_t *avail_pkgs,"
+.B " slapt_pkg_list_t *installed_pkgs);"
.B "
.sp
.fi
@@ -351,7 +351,7 @@ The \fIworking_dir\fP, defined within the \fIslapt_rc_config\fP object, caches t
.B "void slapt_clean_pkg_dir(const char *dir_name);"
.B "void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,"
.B " const char *dir_name,"
-.B " struct slapt_pkg_list *avail_pkgs);"
+.B " slapt_pkg_list_t *avail_pkgs);"
.fi
.sp
.TP
@@ -389,10 +389,10 @@ Downloading packages and the package data from various sources is handled with t
The following functions download the PACKAGES.TXT, the patches/PACKAGES.TXT, CHECKSUMS.md5, and ChangeLog.txt. Each sets the compressed option if a compressed version was available and retrieved.
.sp
.nf
-.B "struct slapt_pkg_list *"
+.B "slapt_pkg_list_t *"
.B "slapt_get_pkg_source_packages (const slapt_rc_config *global_config,"
.B " const char *url, unsigned int *compressed);"
-.B "struct slapt_pkg_list *"
+.B "slapt_pkg_list_t *"
.B "slapt_get_pkg_source_patches (const slapt_rc_config *global_config,"
.B " const char *url, unsigned int *compressed);"
.B "FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,"
@@ -440,20 +440,20 @@ Adding, removing, and upgrading packages can be wrapped in a \fIslapt_transactio
SLAPT_BOOL_T reinstall;
} slapt_pkg_upgrade_t;
.sp
- struct slapt_pkg_upgrade_list {
+ typedef struct {
slapt_pkg_upgrade_t **pkgs;
unsigned int pkg_count;
unsigned int reinstall_count;
- };
+ } slapt_pkg_upgrade_list_t;
.sp
typedef struct {
- struct slapt_pkg_list *install_pkgs;
- struct slapt_pkg_upgrade_list *upgrade_pkgs;
- struct slapt_pkg_list *remove_pkgs;
- struct slapt_pkg_list *exclude_pkgs;
+ slapt_pkg_list_t *install_pkgs;
+ slapt_pkg_upgrade_list_t *upgrade_pkgs;
+ slapt_pkg_list_t *remove_pkgs;
+ slapt_pkg_list_t *exclude_pkgs;
slapt_list_t *suggests;
- struct slapt_pkg_err_list *conflict_err;
- struct slapt_pkg_err_list *missing_err;
+ slapt_pkg_err_list_t *conflict_err;
+ slapt_pkg_err_list_t *missing_err;
slapt_queue_t *queue;
} slapt_transaction_t;
.sp
@@ -490,13 +490,13 @@ Adding, removing, and upgrading packages can be wrapped in a \fIslapt_transactio
.sp
.B "int slapt_add_deps_to_trans(const slapt_rc_config *global_config,"
.B " slapt_transaction_t *tran,"
-.B " struct slapt_pkg_list *avail_pkgs,"
-.B " struct slapt_pkg_list *installed_pkgs,"
+.B " slapt_pkg_list_t *avail_pkgs,"
+.B " slapt_pkg_list_t *installed_pkgs,"
.B " slapt_pkg_info_t *pkg);"
.sp
.B "slapt_pkg_info_t *slapt_is_conflicted(slapt_transaction_t *tran,"
-.B " struct slapt_pkg_list *avail_pkgs,"
-.B " struct slapt_pkg_list *installed_pkgs,"
+.B " slapt_pkg_list_t *avail_pkgs,"
+.B " slapt_pkg_list_t *installed_pkgs,"
.B " slapt_pkg_info_t *pkg);"
.sp
.B "void slapt_generate_suggestions(slapt_transaction_t *tran);"
diff --git a/src/action.c b/src/action.c
index 080463b..4474e29 100644
--- a/src/action.c
+++ b/src/action.c
@@ -26,8 +26,8 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
{
unsigned int i;
slapt_transaction_t *tran = NULL;
- struct slapt_pkg_list *installed_pkgs = NULL;
- struct slapt_pkg_list *avail_pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
+ slapt_pkg_list_t *avail_pkgs = NULL;
slapt_regex_t *pkg_regex = NULL;
printf( gettext("Reading Package Lists...") );
@@ -86,7 +86,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
if ( slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
installed_pkgs,pkg) == 0 ) {
- struct slapt_pkg_list *conflicts = slapt_is_conflicted(tran,avail_pkgs, installed_pkgs, pkg);
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs, installed_pkgs, pkg);
/* if there are conflicts, we schedule the conflicts for removal */
if (conflicts->pkg_count > 0 && global_config->ignore_dep != SLAPT_TRUE) {
@@ -115,7 +115,7 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
if ( slapt_add_deps_to_trans(global_config,tran,avail_pkgs,
installed_pkgs,pkg) == 0 ) {
- struct slapt_pkg_list *conflicts = slapt_is_conflicted(tran,avail_pkgs,
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,
installed_pkgs, pkg);
if (conflicts->pkg_count > 0 && global_config->ignore_dep != SLAPT_TRUE) {
unsigned int cindex = 0;
@@ -161,8 +161,8 @@ void slapt_pkg_action_install(const slapt_rc_config *global_config,
/* list pkgs */
void slapt_pkg_action_list(const int show)
{
- struct slapt_pkg_list *pkgs = NULL;
- struct slapt_pkg_list *installed_pkgs = NULL;
+ slapt_pkg_list_t *pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
unsigned int i;
pkgs = slapt_get_available_pkgs();
@@ -229,8 +229,8 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
const slapt_list_t *action_args)
{
unsigned int i;
- struct slapt_pkg_list *installed_pkgs = NULL;
- struct slapt_pkg_list *avail_pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
+ slapt_pkg_list_t *avail_pkgs = NULL;
slapt_regex_t *pkg_regex = NULL;
slapt_transaction_t *tran = NULL;
@@ -246,7 +246,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
for (i = 0; i < action_args->count; ++i) {
unsigned int c;
- struct slapt_pkg_list *deps = NULL;
+ slapt_pkg_list_t *deps = NULL;
char *arg = action_args->items[i];
slapt_pkg_info_t *pkg = NULL;
@@ -299,7 +299,7 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
}
if (global_config->remove_obsolete == SLAPT_TRUE) {
- struct slapt_pkg_list *obsolete = slapt_get_obsolete_pkgs(
+ slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(
global_config, avail_pkgs, installed_pkgs);
for (i = 0; i < obsolete->pkg_count; ++i) {
@@ -328,9 +328,9 @@ void slapt_pkg_action_remove(const slapt_rc_config *global_config,
void slapt_pkg_action_search(const char *pattern)
{
unsigned int i;
- struct slapt_pkg_list *pkgs = NULL;
- struct slapt_pkg_list *installed_pkgs = NULL;
- struct slapt_pkg_list *matches = NULL,*i_matches = NULL;
+ slapt_pkg_list_t *pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
+ slapt_pkg_list_t *matches = NULL,*i_matches = NULL;
/* read in pkg data */
pkgs = slapt_get_available_pkgs();
@@ -385,8 +385,8 @@ void slapt_pkg_action_search(const char *pattern)
/* show the details for a specific package */
void slapt_pkg_action_show(const char *pkg_name)
{
- struct slapt_pkg_list *avail_pkgs = NULL;
- struct slapt_pkg_list *installed_pkgs = NULL;
+ slapt_pkg_list_t *avail_pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
slapt_regex_t *pkg_regex = NULL;
unsigned int bool_installed = 0;
slapt_pkg_info_t *pkg = NULL;
@@ -477,8 +477,8 @@ void slapt_pkg_action_show(const char *pkg_name)
void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
{
unsigned int i;
- struct slapt_pkg_list *installed_pkgs = NULL;
- struct slapt_pkg_list *avail_pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
+ slapt_pkg_list_t *avail_pkgs = NULL;
slapt_transaction_t *tran = NULL;
printf(gettext("Reading Package Lists..."));
@@ -498,7 +498,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
char *essential[] = {"pkgtools","xz","glibc-solibs","sed","tar","gzip",NULL};
int epi = 0;
slapt_pkg_info_t *newest_slaptget = NULL;
- struct slapt_pkg_list *matches =
+ slapt_pkg_list_t *matches =
slapt_search_pkg_list(avail_pkgs,SLAPT_SLACK_BASE_SET_REGEX);
/* make sure the essential packages are installed/upgraded first */
@@ -551,7 +551,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
if ( slapt_is_excluded(global_config,slapt_upgrade_pkg) == 1 ) {
slapt_add_exclude_to_transaction(tran,slapt_upgrade_pkg);
} else {
- struct slapt_pkg_list *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs,
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs,
slapt_upgrade_pkg);
/* add install if all deps are good and it doesn't have conflicts */
@@ -583,7 +583,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
|| slapt_is_excluded(global_config,slapt_upgrade_pkg) == 1 ) {
slapt_add_exclude_to_transaction(tran,slapt_upgrade_pkg);
} else {
- struct slapt_pkg_list *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs,
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,avail_pkgs,installed_pkgs,
slapt_upgrade_pkg);
/* if all deps are added and there is no conflicts, add on */
@@ -613,7 +613,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
/* remove obsolete packages if prompted to */
if ( global_config->remove_obsolete == SLAPT_TRUE ) {
unsigned int r;
- struct slapt_pkg_list *obsolete = slapt_get_obsolete_pkgs(
+ slapt_pkg_list_t *obsolete = slapt_get_obsolete_pkgs(
global_config, avail_pkgs, installed_pkgs);
for (r = 0; r < obsolete->pkg_count; ++r) {
@@ -687,7 +687,7 @@ void slapt_pkg_action_upgrade_all(const slapt_rc_config *global_config)
) {
slapt_add_exclude_to_transaction(tran,update_pkg);
} else {
- struct slapt_pkg_list *conflicts = slapt_is_conflicted(tran,
+ slapt_pkg_list_t *conflicts = slapt_is_conflicted(tran,
avail_pkgs,installed_pkgs, update_pkg);
/* if all deps are added and there is no conflicts, add on */
@@ -799,7 +799,7 @@ void slapt_pkg_action_add_keys(const slapt_rc_config *global_config)
void slapt_pkg_action_filelist( const char *pkg_name )
{
slapt_regex_t *pkg_regex = NULL;
- struct slapt_pkg_list *installed_pkgs = NULL;
+ slapt_pkg_list_t *installed_pkgs = NULL;
slapt_pkg_info_t *pkg = NULL;
char *filelist = NULL;
diff --git a/src/configuration.c b/src/configuration.c
index dd95b59..d679cd4 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -192,16 +192,16 @@ static slapt_list_t *parse_exclude(char *line)
return slapt_parse_delimited_list(line, ',');
}
-struct slapt_source_list *slapt_init_source_list(void)
+slapt_source_list_t *slapt_init_source_list(void)
{
- struct slapt_source_list *list = slapt_malloc(sizeof *list);
+ slapt_source_list_t *list = slapt_malloc(sizeof *list);
list->src = slapt_malloc(sizeof *list->src);
list->count = 0;
return list;
}
-void slapt_add_source(struct slapt_source_list *list,slapt_source_t *s)
+void slapt_add_source(slapt_source_list_t *list,slapt_source_t *s)
{
slapt_source_t **realloc_tmp;
@@ -220,7 +220,7 @@ void slapt_add_source(struct slapt_source_list *list,slapt_source_t *s)
}
-void slapt_remove_source (struct slapt_source_list *list, const char *s)
+void slapt_remove_source (slapt_source_list_t *list, const char *s)
{
slapt_source_t *src_to_discard = NULL;
unsigned int i = 0;
@@ -255,7 +255,7 @@ void slapt_remove_source (struct slapt_source_list *list, const char *s)
}
-void slapt_free_source_list(struct slapt_source_list *list)
+void slapt_free_source_list(slapt_source_list_t *list)
{
unsigned int i;
diff --git a/src/configuration.h b/src/configuration.h
index 1e601ce..11d65b8 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -12,14 +12,14 @@ typedef struct {
SLAPT_BOOL_T disabled;
} slapt_source_t;
-struct slapt_source_list {
+typedef struct {
slapt_source_t **src;
unsigned int count;
-};
+} slapt_source_list_t;
typedef struct {
char working_dir[SLAPT_WORKINGDIR_TOKEN_LEN];
- struct slapt_source_list *sources;
+ slapt_source_list_t *sources;
slapt_list_t *exclude_list;
int(*progress_cb)(void *,double,double,double,double);
SLAPT_BOOL_T download_only;
@@ -58,10 +58,10 @@ void slapt_free_source(slapt_source_t *src);
add or remove a package source url to the source list.
commonly called with global_config->source_list
*/
-struct slapt_source_list *slapt_init_source_list(void);
-void slapt_add_source(struct slapt_source_list *list, slapt_source_t *s);
-void slapt_remove_source (struct slapt_source_list *list, const char *s);
-void slapt_free_source_list(struct slapt_source_list *list);
+slapt_source_list_t *slapt_init_source_list(void);
+void slapt_add_source(slapt_source_list_t *list, slapt_source_t *s);
+void slapt_remove_source (slapt_source_list_t *list, const char *s);
+void slapt_free_source_list(slapt_source_list_t *list);
SLAPT_BOOL_T slapt_is_interactive(const slapt_rc_config *);
diff --git a/src/main.c b/src/main.c
index a839ea7..9eb66ff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -329,12 +329,12 @@ int main( int argc, char *argv[] )
case INSTALL_DISK_SET:
{
unsigned int set_i;
- struct slapt_pkg_list *set_pkgs = slapt_init_pkg_list();
- struct slapt_pkg_list *avail_pkgs = slapt_get_available_pkgs();
+ slapt_pkg_list_t *set_pkgs = slapt_init_pkg_list();
+ slapt_pkg_list_t *avail_pkgs = slapt_get_available_pkgs();
while (optind < argc) {
unsigned int search_i;
- struct slapt_pkg_list *matches = NULL;
+ slapt_pkg_list_t *matches = NULL;
char *search = slapt_malloc(sizeof *search * (strlen(argv[optind]) + 3));
snprintf(search,strlen(argv[optind]) + 3,"/%s$",argv[optind]);
diff --git a/src/package.c b/src/package.c
index f5d3ab1..ffd2677 100644
--- a/src/package.c
+++ b/src/package.c
@@ -28,31 +28,31 @@ static int pkg_compare (const void *a, const void *b);
/* analyze the pkg version hunk by hunk */
static struct slapt_pkg_version_parts *break_down_pkg_version(const char *version);
/* parse the meta lines */
-static slapt_pkg_info_t *parse_meta_entry(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
char *dep_entry);
/* called by slapt_is_required_by */
-static void required_by(struct slapt_pkg_list *avail,
- struct slapt_pkg_list *installed_pkgs,
- struct slapt_pkg_list *pkgs_to_install,
- struct slapt_pkg_list *pkgs_to_remove,
+static void required_by(slapt_pkg_list_t *avail,
+ slapt_pkg_list_t *installed_pkgs,
+ slapt_pkg_list_t *pkgs_to_install,
+ slapt_pkg_list_t *pkgs_to_remove,
slapt_pkg_info_t *pkg,
- struct slapt_pkg_list *required_by_list);
+ slapt_pkg_list_t *required_by_list);
static char *escape_package_name(slapt_pkg_info_t *pkg);
/* free pkg_version_parts struct */
static void slapt_free_pkg_version_parts(struct slapt_pkg_version_parts *parts);
/* find dependency from "or" requirement */
-static slapt_pkg_info_t *find_or_requirement(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+static slapt_pkg_info_t *find_or_requirement(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
char *required_str);
/* uncompress compressed package data */
static FILE *slapt_gunzip_file (const char *file_name,FILE *dest_file);
/* parse the PACKAGES.TXT file */
-struct slapt_pkg_list *slapt_get_available_pkgs(void)
+slapt_pkg_list_t *slapt_get_available_pkgs(void)
{
FILE *pkg_list_fh;
- struct slapt_pkg_list *list = NULL;
+ slapt_pkg_list_t *list = NULL;
/* open pkg list */
pkg_list_fh = slapt_open_file(SLAPT_PKG_LIST_L,"r");
@@ -74,7 +74,7 @@ struct slapt_pkg_list *slapt_get_available_pkgs(void)
return list;
}
-struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
+slapt_pkg_list_t *slapt_parse_packages_txt(FILE *pkg_list_fh)
{
slapt_regex_t *name_regex = NULL,
*mirror_regex = NULL,
@@ -83,7 +83,7 @@ struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
*size_c_regex = NULL,
*size_u_regex = NULL;
ssize_t bytes_read;
- struct slapt_pkg_list *list = NULL;
+ slapt_pkg_list_t *list = NULL;
long f_pos = 0;
size_t getline_len = 0;
char *getline_buffer = NULL;
@@ -477,7 +477,7 @@ char *slapt_gen_short_pkg_description(slapt_pkg_info_t *pkg)
}
-struct slapt_pkg_list *slapt_get_installed_pkgs(void)
+slapt_pkg_list_t *slapt_get_installed_pkgs(void)
{
DIR *pkg_log_dir;
char *pkg_log_dirname = NULL;
@@ -485,7 +485,7 @@ struct slapt_pkg_list *slapt_get_installed_pkgs(void)
slapt_regex_t *ip_regex = NULL,
*compressed_size_reg = NULL,
*uncompressed_size_reg = NULL;
- struct slapt_pkg_list *list = NULL;
+ slapt_pkg_list_t *list = NULL;
size_t pls = 1;
list = slapt_init_pkg_list();
@@ -694,7 +694,7 @@ struct slapt_pkg_list *slapt_get_installed_pkgs(void)
}
/* lookup newest package from pkg_list */
-slapt_pkg_info_t *slapt_get_newest_pkg(struct slapt_pkg_list *pkg_list,
+slapt_pkg_info_t *slapt_get_newest_pkg(slapt_pkg_list_t *pkg_list,
const char *pkg_name)
{
unsigned int i;
@@ -714,7 +714,7 @@ slapt_pkg_info_t *slapt_get_newest_pkg(struct slapt_pkg_list *pkg_list,
return pkg;
}
-slapt_pkg_info_t *slapt_get_exact_pkg(struct slapt_pkg_list *list,
+slapt_pkg_info_t *slapt_get_exact_pkg(slapt_pkg_list_t *list,
const char *name,
const char *version)
{
@@ -889,7 +889,7 @@ void slapt_free_pkg(slapt_pkg_info_t *pkg)
free(pkg);
}
-void slapt_free_pkg_list(struct slapt_pkg_list *list)
+void slapt_free_pkg_list(slapt_pkg_list_t *list)
{
unsigned int i;
if (list->free_pkgs == SLAPT_TRUE) {
@@ -952,7 +952,7 @@ int slapt_is_excluded(const slapt_rc_config *global_config,
return pkg_not_excluded;
}
-void slapt_get_md5sums(struct slapt_pkg_list *pkgs, FILE *checksum_file)
+void slapt_get_md5sums(slapt_pkg_list_t *pkgs, FILE *checksum_file)
{
slapt_regex_t *md5sum_regex = NULL;
ssize_t getline_read;
@@ -1235,7 +1235,7 @@ static struct slapt_pkg_version_parts *break_down_pkg_version(const char *versio
}
void slapt_write_pkg_data(const char *source_url,FILE *d_file,
- struct slapt_pkg_list *pkgs)
+ slapt_pkg_list_t *pkgs)
{
unsigned int i;
@@ -1278,13 +1278,13 @@ void slapt_write_pkg_data(const char *source_url,FILE *d_file,
}
}
-struct slapt_pkg_list *slapt_search_pkg_list(struct slapt_pkg_list *list,
+slapt_pkg_list_t *slapt_search_pkg_list(slapt_pkg_list_t *list,
const char *pattern)
{
unsigned int i;
int name_r = -1,desc_r = -1,loc_r = -1,version_r = -1;
slapt_regex_t *search_regex = NULL;
- struct slapt_pkg_list *matches = NULL;
+ slapt_pkg_list_t *matches = NULL;
matches = slapt_init_pkg_list();
@@ -1321,11 +1321,11 @@ struct slapt_pkg_list *slapt_search_pkg_list(struct slapt_pkg_list *list,
/* lookup dependencies for pkg */
int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,slapt_pkg_info_t *pkg,
- struct slapt_pkg_list *deps,
- struct slapt_pkg_err_list *conflict_err,
- struct slapt_pkg_err_list *missing_err)
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,slapt_pkg_info_t *pkg,
+ slapt_pkg_list_t *deps,
+ slapt_pkg_err_list_t *conflict_err,
+ slapt_pkg_err_list_t *missing_err)
{
unsigned int i = 0;
slapt_list_t *dep_parts = NULL;
@@ -1427,11 +1427,11 @@ int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
}
/* lookup conflicts for package */
-struct slapt_pkg_list *slapt_get_pkg_conflicts(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+slapt_pkg_list_t *slapt_get_pkg_conflicts(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg)
{
- struct slapt_pkg_list *conflicts = NULL;
+ slapt_pkg_list_t *conflicts = NULL;
int position = 0,len = 0;
char *pointer = NULL;
char *buffer = NULL;
@@ -1491,8 +1491,8 @@ struct slapt_pkg_list *slapt_get_pkg_conflicts(struct slapt_pkg_list *avail_pkgs
return conflicts;
}
-static slapt_pkg_info_t *parse_meta_entry(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+static slapt_pkg_info_t *parse_meta_entry(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
char *dep_entry)
{
unsigned int i;
@@ -1697,14 +1697,14 @@ static slapt_pkg_info_t *parse_meta_entry(struct slapt_pkg_list *avail_pkgs,
return NULL;
}
-struct slapt_pkg_list *slapt_is_required_by(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail,
- struct slapt_pkg_list *installed_pkgs,
- struct slapt_pkg_list *pkgs_to_install,
- struct slapt_pkg_list *pkgs_to_remove,
+slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
+ slapt_pkg_list_t *avail,
+ slapt_pkg_list_t *installed_pkgs,
+ slapt_pkg_list_t *pkgs_to_install,
+ slapt_pkg_list_t *pkgs_to_remove,
slapt_pkg_info_t *pkg)
{
- struct slapt_pkg_list *required_by_list = slapt_init_pkg_list();
+ slapt_pkg_list_t *required_by_list = slapt_init_pkg_list();
/*
* don't go any further if disable_dep_check is set
@@ -1747,12 +1747,12 @@ static char *escape_package_name(slapt_pkg_info_t *pkg)
return escaped_name;
}
-static void required_by(struct slapt_pkg_list *avail,
- struct slapt_pkg_list *installed_pkgs,
- struct slapt_pkg_list *pkgs_to_install,
- struct slapt_pkg_list *pkgs_to_remove,
+static void required_by(slapt_pkg_list_t *avail,
+ slapt_pkg_list_t *installed_pkgs,
+ slapt_pkg_list_t *pkgs_to_install,
+ slapt_pkg_list_t *pkgs_to_remove,
slapt_pkg_info_t *pkg,
- struct slapt_pkg_list *required_by_list)
+ slapt_pkg_list_t *required_by_list)
{
unsigned int i;
slapt_regex_t *required_by_reg = NULL;
@@ -1852,7 +1852,7 @@ static void required_by(struct slapt_pkg_list *avail,
slapt_free_regex(required_by_reg);
}
-slapt_pkg_info_t *slapt_get_pkg_by_details(struct slapt_pkg_list *list,
+slapt_pkg_info_t *slapt_get_pkg_by_details(slapt_pkg_list_t *list,
const char *name,
const char *version,
const char *location)
@@ -1936,14 +1936,14 @@ slapt_pkg_info_t *slapt_get_pkg_by_details(struct slapt_pkg_list *list,
int slapt_update_pkg_cache(const slapt_rc_config *global_config)
{
unsigned int i,source_dl_failed = 0;
- struct slapt_pkg_list *new_pkgs = slapt_init_pkg_list();
+ slapt_pkg_list_t *new_pkgs = slapt_init_pkg_list();
new_pkgs->free_pkgs = SLAPT_TRUE;
/* go through each package source and download the meta data */
for (i = 0; i < global_config->sources->count; i++) {
unsigned int compressed = 0;
- struct slapt_pkg_list *available_pkgs = NULL;
- struct slapt_pkg_list *patch_pkgs = NULL;
+ slapt_pkg_list_t *available_pkgs = NULL;
+ slapt_pkg_list_t *patch_pkgs = NULL;
FILE *tmp_checksum_f = NULL;
#ifdef SLAPT_HAS_GPGME
FILE *tmp_signature_f = NULL;
@@ -2113,9 +2113,9 @@ int slapt_update_pkg_cache(const slapt_rc_config *global_config)
return source_dl_failed;
}
-struct slapt_pkg_list *slapt_init_pkg_list(void)
+slapt_pkg_list_t *slapt_init_pkg_list(void)
{
- struct slapt_pkg_list *list = NULL;
+ slapt_pkg_list_t *list = NULL;
list = slapt_malloc(sizeof *list);
list->pkgs = slapt_malloc(sizeof *list->pkgs);
@@ -2126,7 +2126,7 @@ struct slapt_pkg_list *slapt_init_pkg_list(void)
return list;
}
-void slapt_add_pkg_to_pkg_list(struct slapt_pkg_list *list,
+void slapt_add_pkg_to_pkg_list(slapt_pkg_list_t *list,
slapt_pkg_info_t *pkg)
{
slapt_pkg_info_t **realloc_tmp;
@@ -2325,7 +2325,7 @@ char *slapt_gen_filename_from_url(const char *url,const char *file)
void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,
const char *dir_name,
- struct slapt_pkg_list *avail_pkgs)
+ slapt_pkg_list_t *avail_pkgs)
{
DIR *dir;
struct dirent *file;
@@ -2481,8 +2481,8 @@ void slapt_clean_pkg_dir(const char *dir_name)
}
/* find dependency from "or" requirement */
-static slapt_pkg_info_t *find_or_requirement(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+static slapt_pkg_info_t *find_or_requirement(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
char *required_str)
{
slapt_pkg_info_t *pkg = NULL;
@@ -2545,16 +2545,16 @@ slapt_pkg_info_t *slapt_copy_pkg(slapt_pkg_info_t *dst,slapt_pkg_info_t *src)
return dst;
}
-struct slapt_pkg_err_list *slapt_init_pkg_err_list(void)
+slapt_pkg_err_list_t *slapt_init_pkg_err_list(void)
{
- struct slapt_pkg_err_list *l = slapt_malloc(sizeof *l);
+ slapt_pkg_err_list_t *l = slapt_malloc(sizeof *l);
l->errs = slapt_malloc(sizeof *l->errs);
l->err_count = 0;
return l;
}
-void slapt_add_pkg_err_to_list(struct slapt_pkg_err_list *l,
+void slapt_add_pkg_err_to_list(slapt_pkg_err_list_t *l,
const char *pkg,const char *err)
{
slapt_pkg_err_t **tmp;
@@ -2576,7 +2576,7 @@ void slapt_add_pkg_err_to_list(struct slapt_pkg_err_list *l,
}
-int slapt_search_pkg_err_list(struct slapt_pkg_err_list *l,
+int slapt_search_pkg_err_list(slapt_pkg_err_list_t *l,
const char *pkg, const char *err)
{
unsigned int i,found = 1, not_found = 0;
@@ -2590,7 +2590,7 @@ int slapt_search_pkg_err_list(struct slapt_pkg_err_list *l,
return not_found;
}
-void slapt_free_pkg_err_list(struct slapt_pkg_err_list *l)
+void slapt_free_pkg_err_list(slapt_pkg_err_list_t *l)
{
unsigned int i;
@@ -2625,10 +2625,10 @@ static FILE *slapt_gunzip_file (const char *file_name,FILE *dest_file)
return dest_file;
}
-struct slapt_pkg_list *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
+slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
const char *url, unsigned int *compressed)
{
- struct slapt_pkg_list *available_pkgs = NULL;
+ slapt_pkg_list_t *available_pkgs = NULL;
char *pkg_head = NULL;
SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
@@ -2821,10 +2821,10 @@ struct slapt_pkg_list *slapt_get_pkg_source_packages (const slapt_rc_config *glo
return available_pkgs;
}
-struct slapt_pkg_list *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
+slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
const char *url, unsigned int *compressed)
{
- struct slapt_pkg_list *patch_pkgs = NULL;
+ slapt_pkg_list_t *patch_pkgs = NULL;
char *patch_head = NULL;
SLAPT_BOOL_T is_interactive = slapt_is_interactive(global_config);
*compressed = 0;
@@ -3339,15 +3339,15 @@ char *slapt_stringify_pkg(const slapt_pkg_info_t *pkg)
return pkg_str;
}
-struct slapt_pkg_list *
+slapt_pkg_list_t *
slapt_get_obsolete_pkgs ( const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs)
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs)
{
unsigned int r;
- struct slapt_pkg_list *obsolete = slapt_init_pkg_list();
- struct slapt_pkg_list *to_install = slapt_init_pkg_list();
- struct slapt_pkg_list *to_remove = slapt_init_pkg_list();
+ slapt_pkg_list_t *obsolete = slapt_init_pkg_list();
+ slapt_pkg_list_t *to_install = slapt_init_pkg_list();
+ slapt_pkg_list_t *to_remove = slapt_init_pkg_list();
for (r = 0; r < installed_pkgs->pkg_count; ++r) {
slapt_pkg_info_t *p = installed_pkgs->pkgs[r];
@@ -3357,7 +3357,7 @@ struct slapt_pkg_list *
* it must be obsolete
*/
if (slapt_get_newest_pkg(avail_pkgs, p->name) == NULL) {
- struct slapt_pkg_list *deps;
+ slapt_pkg_list_t *deps;
unsigned int c;
/*
diff --git a/src/package.h b/src/package.h
index fa39f6d..429e495 100644
--- a/src/package.h
+++ b/src/package.h
@@ -51,12 +51,12 @@ typedef struct {
SLAPT_BOOL_T installed;
} slapt_pkg_info_t;
-struct slapt_pkg_list {
+typedef struct {
slapt_pkg_info_t **pkgs;
unsigned int pkg_count;
SLAPT_BOOL_T free_pkgs;
SLAPT_BOOL_T ordered;
-};
+} slapt_pkg_list_t;
typedef struct {
slapt_pkg_info_t *installed;
@@ -64,21 +64,21 @@ typedef struct {
SLAPT_BOOL_T reinstall;
} slapt_pkg_upgrade_t;
-struct slapt_pkg_upgrade_list {
+typedef struct {
slapt_pkg_upgrade_t **pkgs;
unsigned int pkg_count;
unsigned int reinstall_count;
-};
+} slapt_pkg_upgrade_list_t;
typedef struct {
char *pkg;
char *error;
} slapt_pkg_err_t;
-struct slapt_pkg_err_list {
+typedef struct {
slapt_pkg_err_t **errs;
unsigned int err_count;
-};
+} slapt_pkg_err_list_t;
/* returns an empty package structure */
__inline slapt_pkg_info_t *slapt_init_pkg(void);
@@ -86,12 +86,12 @@ __inline slapt_pkg_info_t *slapt_init_pkg(void);
void slapt_free_pkg(slapt_pkg_info_t *pkg);
/* create an empty package list */
-struct slapt_pkg_list *slapt_init_pkg_list(void);
+slapt_pkg_list_t *slapt_init_pkg_list(void);
/* add a package to a package list */
-void slapt_add_pkg_to_pkg_list(struct slapt_pkg_list *list,
+void slapt_add_pkg_to_pkg_list(slapt_pkg_list_t *list,
slapt_pkg_info_t *pkg);
/* free package list */
-void slapt_free_pkg_list(struct slapt_pkg_list *);
+void slapt_free_pkg_list(slapt_pkg_list_t *);
/*
update the local package cache. Must be chdir'd to working_dir.
@@ -99,31 +99,31 @@ void slapt_free_pkg_list(struct slapt_pkg_list *);
int slapt_update_pkg_cache(const slapt_rc_config *global_config);
/* write pkg data to disk */
void slapt_write_pkg_data(const char *source_url,FILE *d_file,
- struct slapt_pkg_list *pkgs);
+ slapt_pkg_list_t *pkgs);
/* parse the PACKAGES.TXT file */
-struct slapt_pkg_list *slapt_parse_packages_txt(FILE *);
+slapt_pkg_list_t *slapt_parse_packages_txt(FILE *);
/*
return a list of available packages. Must be chdir'd to
rc_config->working_dir. Otherwise, open a filehandle to the package data
and pass it to slapt_parse_packages_txt();
*/
-struct slapt_pkg_list *slapt_get_available_pkgs(void);
+slapt_pkg_list_t *slapt_get_available_pkgs(void);
/* retrieve list of installed pkgs */
-struct slapt_pkg_list *slapt_get_installed_pkgs(void);
+slapt_pkg_list_t *slapt_get_installed_pkgs(void);
/* retrieve the newest package from package list */
-slapt_pkg_info_t *slapt_get_newest_pkg(struct slapt_pkg_list *,const char *);
+slapt_pkg_info_t *slapt_get_newest_pkg(slapt_pkg_list_t *,const char *);
/* get the exact package */
-slapt_pkg_info_t *slapt_get_exact_pkg(struct slapt_pkg_list *list,
+slapt_pkg_info_t *slapt_get_exact_pkg(slapt_pkg_list_t *list,
const char *name,
const char *version);
/* lookup package by details */
-slapt_pkg_info_t *slapt_get_pkg_by_details(struct slapt_pkg_list *list,
+slapt_pkg_info_t *slapt_get_pkg_by_details(slapt_pkg_list_t *list,
const char *name,
const char *version,
const char *location);
/* search package list with pattern */
-struct slapt_pkg_list *slapt_search_pkg_list(struct slapt_pkg_list *list,
+slapt_pkg_list_t *slapt_search_pkg_list(slapt_pkg_list_t *list,
const char *pattern);
@@ -145,10 +145,10 @@ int slapt_upgrade_pkg(const slapt_rc_config *global_config,
int slapt_remove_pkg(const slapt_rc_config *,slapt_pkg_info_t *);
/* get a list of obsolete packages */
-struct slapt_pkg_list *
+slapt_pkg_list_t *
slapt_get_obsolete_pkgs ( const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs);
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs);
/*
@@ -191,7 +191,7 @@ slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,
/*
fill in the md5sum of the package
*/
-void slapt_get_md5sums(struct slapt_pkg_list *pkgs, FILE *checksum_file);
+void slapt_get_md5sums(slapt_pkg_list_t *pkgs, FILE *checksum_file);
/*
find out the pkg file size (post download)
*/
@@ -214,26 +214,26 @@ int slapt_cmp_pkgs(slapt_pkg_info_t *a, slapt_pkg_info_t *b);
(usually called with transaction->conflict_err and transaction->missing_err)
*/
int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg,
- struct slapt_pkg_list *deps,
- struct slapt_pkg_err_list *conflict_err,
- struct slapt_pkg_err_list *missing_err);
+ slapt_pkg_list_t *deps,
+ slapt_pkg_err_list_t *conflict_err,
+ slapt_pkg_err_list_t *missing_err);
/*
return list of package conflicts
*/
-struct slapt_pkg_list *slapt_get_pkg_conflicts(struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+slapt_pkg_list_t *slapt_get_pkg_conflicts(slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg);
/*
return list of packages required by
*/
-struct slapt_pkg_list *slapt_is_required_by(const slapt_rc_config *global_config,
- struct slapt_pkg_list *avail,
- struct slapt_pkg_list *installed_pkgs,
- struct slapt_pkg_list *pkgs_to_install,
- struct slapt_pkg_list *pkgs_to_remove,
+slapt_pkg_list_t *slapt_is_required_by(const slapt_rc_config *global_config,
+ slapt_pkg_list_t *avail,
+ slapt_pkg_list_t *installed_pkgs,
+ slapt_pkg_list_t *pkgs_to_install,
+ slapt_pkg_list_t *pkgs_to_remove,
slapt_pkg_info_t *pkg);
/*
@@ -246,7 +246,7 @@ void slapt_clean_pkg_dir(const char *dir_name);
*/
void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,
const char *dir_name,
- struct slapt_pkg_list *avail_pkgs);
+ slapt_pkg_list_t *avail_pkgs);
/*
make a copy of a package (needs to be freed with free_pkg)
@@ -256,20 +256,20 @@ slapt_pkg_info_t *slapt_copy_pkg(slapt_pkg_info_t *dst,slapt_pkg_info_t *src);
/*
package error handling api to handle errors within core functions
*/
-struct slapt_pkg_err_list *slapt_init_pkg_err_list(void);
-void slapt_add_pkg_err_to_list(struct slapt_pkg_err_list *l,
+slapt_pkg_err_list_t *slapt_init_pkg_err_list(void);
+void slapt_add_pkg_err_to_list(slapt_pkg_err_list_t *l,
const char *pkg,const char *err);
-int slapt_search_pkg_err_list(struct slapt_pkg_err_list *l,
+int slapt_search_pkg_err_list(slapt_pkg_err_list_t *l,
const char *pkg, const char *err);
-void slapt_free_pkg_err_list(struct slapt_pkg_err_list *l);
+void slapt_free_pkg_err_list(slapt_pkg_err_list_t *l);
/*
download the PACKAGES.TXT and CHECKSUMS.md5 files
compressed is set to 1 if the compressed version was downloaded.
*/
-struct slapt_pkg_list *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
+slapt_pkg_list_t *slapt_get_pkg_source_packages (const slapt_rc_config *global_config,
const char *url, unsigned int *compressed);
-struct slapt_pkg_list *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
+slapt_pkg_list_t *slapt_get_pkg_source_patches (const slapt_rc_config *global_config,
const char *url, unsigned int *compressed);
FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,
const char *url, unsigned int *compressed);
diff --git a/src/transaction.c b/src/transaction.c
index d2a2dbc..d2566d7 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -828,13 +828,13 @@ slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,
/* needed check to see if a package is conflicted */
int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
slapt_transaction_t *tran,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg)
{
unsigned int c;
int dep_return = -1;
- struct slapt_pkg_list *deps = NULL;
+ slapt_pkg_list_t *deps = NULL;
if (global_config->disable_dep_check == SLAPT_TRUE)
return 0;
@@ -863,7 +863,7 @@ int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
unsigned int cindex = 0;
slapt_pkg_info_t *dep = deps->pkgs[c];
slapt_pkg_info_t *dep_installed = NULL;
- struct slapt_pkg_list *conflicts = NULL;
+ slapt_pkg_list_t *conflicts = NULL;
/*
* the dep wouldn't get this far if it where excluded,
@@ -896,14 +896,14 @@ int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
}
/* make sure pkg isn't conflicted with what's already in the transaction */
-struct slapt_pkg_list *slapt_is_conflicted(slapt_transaction_t *tran,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+slapt_pkg_list_t *slapt_is_conflicted(slapt_transaction_t *tran,
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg)
{
unsigned int i;
- struct slapt_pkg_list *conflicts = NULL;
- struct slapt_pkg_list *conflicts_in_transaction = slapt_init_pkg_list();
+ slapt_pkg_list_t *conflicts = NULL;
+ slapt_pkg_list_t *conflicts_in_transaction = slapt_init_pkg_list();
/* if conflicts exist, check to see if they are installed
or in the current transaction
diff --git a/src/transaction.h b/src/transaction.h
index d663994..2ad262c 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -16,13 +16,13 @@ typedef struct {
} slapt_queue_t;
typedef struct {
- struct slapt_pkg_list *install_pkgs;
- struct slapt_pkg_upgrade_list *upgrade_pkgs;
- struct slapt_pkg_list *remove_pkgs;
- struct slapt_pkg_list *exclude_pkgs;
+ slapt_pkg_list_t *install_pkgs;
+ slapt_pkg_upgrade_list_t *upgrade_pkgs;
+ slapt_pkg_list_t *remove_pkgs;
+ slapt_pkg_list_t *exclude_pkgs;
slapt_list_t *suggests;
- struct slapt_pkg_err_list *conflict_err;
- struct slapt_pkg_err_list *missing_err;
+ slapt_pkg_err_list_t *conflict_err;
+ slapt_pkg_err_list_t *missing_err;
slapt_queue_t *queue;
} slapt_transaction_t;
@@ -75,16 +75,16 @@ int slapt_search_upgrade_transaction(slapt_transaction_t *tran,
*/
int slapt_add_deps_to_trans(const slapt_rc_config *global_config,
slapt_transaction_t *tran,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs, slapt_pkg_info_t *pkg);
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs, slapt_pkg_info_t *pkg);
/*
check to see if a package has a conflict already present in the transaction
returns conflicted package or NULL if none
*/
-struct slapt_pkg_list *slapt_is_conflicted(slapt_transaction_t *tran,
- struct slapt_pkg_list *avail_pkgs,
- struct slapt_pkg_list *installed_pkgs,
+slapt_pkg_list_t *slapt_is_conflicted(slapt_transaction_t *tran,
+ slapt_pkg_list_t *avail_pkgs,
+ slapt_pkg_list_t *installed_pkgs,
slapt_pkg_info_t *pkg);
/*