FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

LinkBack Thread Tools
Old 07-21-2008, 12:05 PM
Default vercmp discussion (was: String freeze for 3.2 release)

On Mon, Jul 21, 2008 at 12:01 PM, Xavier <shiningxc@gmail.com> wrote:
> On Mon, Jul 21, 2008 at 11:25 AM, Xavier <shiningxc@gmail.com> wrote:
>> Apparently the static strings were a show stopper to Dan.
>> I don't have a problem with static strings, since it removes the
>> malloc/free overhead and also simplifies the code.
>> As always with dynamic strings, we have the choice between duplicating
>> all free calls, or using goto.
>> But anyway, here is a new patch using strdup/free instead of static arrays.
> This breaks sync1000, sync1003 and upgrade075 pactest, but I have not
> yet been able to figure out why.

Well I found a fix, which looks correct to me, but I am still highly
confused about why the old vercmp function with static strings worked
Also, my vercmp function had problems when being called from checkdeps
(which is why it broke the 3 pactests above), and probably the two
arguments of vercmp in this case are dynamic strings.
But it didn't have any problems when being called from the vercmp tool
(src/util/vercmp) which use static strings, because all tests in
pactest/vercmptest still passed fine.

Anyway, after the fix, the calls from checkdeps and vercmp tool both work fine.

diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index d0ca58a..8a36e56 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -593,12 +593,12 @@ int SYMEXPORT alpm_pkg_vercmp(const char *a,
const char *b)

/* lose the release number */
for(one = str1; *one && *one != '-'; one++);
- if(one) {
+ if(*one) {
*one = '';
rel1 = ++one;
for(two = str2; *two && *two != '-'; two++);
- if(two) {
+ if(*two) {
*two = '';
rel2 = ++two;
pacman-dev mailing list

Thread Tools

All times are GMT. The time now is 12:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org