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 01-14-2008, 12:33 PM
Nagy Gabor
 
Default small sync.c code clean-up

>From e7c8c05f91737d5e96cd2e6ec80958580619d1b1 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Mon, 14 Jan 2008 14:29:41 +0100
Subject: [PATCH] small sync.c code clean-up

Remove unnecessary synclist_free function, and use our standard way (alpm_list_free_inner + alpm_list_free) instead.
This slightly reduces code duplication.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
---
lib/libalpm/sync.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index fbe5780..ca50efe 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -78,20 +78,6 @@ void _alpm_sync_free(pmsyncpkg_t *sync)
FREE(sync);
}

-static void synclist_free(alpm_list_t *syncpkgs)
-{
- if(syncpkgs) {
- alpm_list_t *tmp;
- for(tmp = syncpkgs; tmp; tmp = alpm_list_next(tmp)) {
- if(tmp->data) {
- _alpm_sync_free(tmp->data);
- }
- }
- alpm_list_free(syncpkgs);
- }
-
-}
-
/* Find recommended replacements for packages during a sync.
*/
static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
@@ -154,7 +140,9 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
sync = _alpm_sync_new(PM_SYNC_TYPE_REPLACE, spkg, NULL);
if(sync == NULL) {
pm_errno = PM_ERR_MEMORY;
- synclist_free(*syncpkgs);
+ alpm_list_free_inner(*syncpkgs, (alpm_list_fn_free)_alpm_sync_free);
+ alpm_list_free(*syncpkgs);
+ *syncpkgs = NULL;
return(-1);
}
sync->data = alpm_list_add(NULL, lpkg);
@@ -244,7 +232,9 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans,
sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, local);
if(sync == NULL) {
pm_errno = PM_ERR_MEMORY;
- synclist_free(*syncpkgs);
+ alpm_list_free_inner(*syncpkgs, (alpm_list_fn_free)_alpm_sync_free);
+ alpm_list_free(*syncpkgs);
+ *syncpkgs = NULL;
return(-1);
}
*syncpkgs = alpm_list_add(*syncpkgs, sync);
--
1.5.3.7



_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 05:16 AM.

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