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 05-01-2008, 10:34 PM
Nagy Gabor
 
Default One liner _alpm_pkg_find

>From f08d8647274fc2c582005f9f0baebc114b2829cd Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Fri, 2 May 2008 00:32:45 +0200
Subject: [PATCH] One liner _alpm_pkg_find

This patch kills some code duplication.

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

diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index ab49492..313c84a 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -1095,22 +1095,8 @@ error:
*/
pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle)
{
- alpm_list_t *lp;
-
ALPM_LOG_FUNC;
-
- if(needle == NULL || haystack == NULL) {
- return(NULL);
- }
-
- for(lp = haystack; lp; lp = lp->next) {
- pmpkg_t *info = lp->data;
-
- if(info && strcmp(alpm_pkg_get_name(info), needle) == 0) {
- return(info);
- }
- }
- return(NULL);
+ return(alpm_list_find(haystack, needle, _alpm_pkgname_pkg_cmp));
}

/** Test if a package should be ignored.
--
1.5.3.8


_______________________________________________
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 11:24 AM.

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