* Remove -fno-strict-aliasing as it is now unnecessary to compile.

* Fix up add.c a bit better than it was in regards to FS #3492.
* Optimized the sqrt call in dependency cycle checking to a single call.
* Removal of an outdated comment.
This commit is contained in:
Dan McGee 2007-01-30 05:41:13 +00:00
parent e668b47142
commit 0bc06918e4
6 changed files with 35 additions and 21 deletions

View File

@ -1,8 +1,6 @@
AUTOMAKE_OPTIONS = gnu
DEFINES = -pedantic -D_GNU_SOURCE
#libalpm isn't fully C99 safe with the strict aliasing rules
# to be fixed in the future
AM_CFLAGS = $(DEFINES) -fno-strict-aliasing
AM_CFLAGS = $(DEFINES)
SUBDIRS = po
localedir = $(datadir)/locale

View File

@ -211,9 +211,12 @@ error:
}
static int name_cmp(const void *p1, const void *p2)
/* This is still messy. We have a lot of compare functions, and we should
* try to consolidate them as much as we can (between add and sync) */
static int pkg_cmp(const void *p1, const void *p2)
{
return(strcmp(((pmpkg_t *)p1)->name, (const char *)p2));
return(strcmp(((pmdepmissing_t *)p1)->target,
((pmdepmissing_t *)p2)->target));
}
int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
@ -253,11 +256,26 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
/* Attempt to resolve conflicts */
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &skip_this);
if(skip_this) {
pmpkg_t **pkg = NULL;
lp = alpm_list_remove(lp, (void *)miss->depend.name, name_cmp, (void **)pkg);
FREEPKG(*pkg);
}
}
pmdepmissing_t *pkg = NULL;
lp = alpm_list_remove(lp, (void *)miss, pkg_cmp, (void*)&pkg);
/* TODO: We remove the conflict from the list but never actually remove
* the package. Need to do this to fix FS #3492. The sync code should
* provide an example of how to do this, as it handles replaces and
* removes. We run into problems because we do a file conflict check
* below and it fails there. A force flag will skip that part, but
* still not remove the original package designated here for removal.
* Better yet, dump all this shitty duplicate code and somehow combine
* it with the sync code. */
FREE(pkg);
if(lp == NULL) {
break;
}
}
}
/* Removal code should go here, as described above. Instead of simply
* removing items, perhaps throw them in another list to be removed, then
* proceed as sync.c would? I'm not sure because I'm not familiar enough
* with the codebase. */
if(lp != NULL) {
if(data) {
*data = lp;

View File

@ -106,6 +106,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode)
int change = 1;
int numscans = 0;
int numtargs = 0;
int maxscans;
if(targets == NULL) {
return(NULL);
@ -116,15 +117,13 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode)
numtargs++;
}
maxscans = (int)sqrt(numtargs);
_alpm_log(PM_LOG_DEBUG, _("started sorting dependencies"));
while(change) {
alpm_list_t *tmptargs = NULL;
change = 0;
/* TODO only use of a math.h function in entire libalpm,
* can we get rid of it? Former code line:
*if(numscans > numtargs) {
*/
if(numscans > sqrt(numtargs)) {
if(numscans > maxscans) {
_alpm_log(PM_LOG_DEBUG, _("possible dependency cycle detected"));
continue;
}
@ -321,9 +320,9 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
depend.name, tp->name);
depend.name, tp->name);
miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
depend.name, depend.version);
depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {

View File

@ -359,8 +359,8 @@ int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
/* Use ISO-8601 date format */
fprintf(f, "[%04d-%02d-%02d %02d:%02d] %s\n",
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, str);
tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, str);
fflush(f);
}

View File

@ -148,7 +148,7 @@ for category in $*; do
fi
done
done
ed=`date +"[%b %d %H:%M]"`
ed=$(date +"[%b %d %H:%M]")
echo "makeworld complete." >>$toplevel/build.log
echo " started: $sd" >>$toplevel/build.log

View File

@ -526,7 +526,6 @@ int pacman_sync(alpm_list_t *targets)
found++;
MSG(NL, _(":: group %s:\n"), targ);
/* remove dupe entries in case a package exists in multiple repos */
/* (the dupe function takes a pmlist_t* and returns a list_t*) */
alpm_list_t *pkgs = alpm_list_remove_dupes(alpm_grp_get_packages(grp));
list_display(" ", pkgs);
if(yesno(_(":: Install whole content? [Y/n] "))) {