Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Donnie Berkholz <dberkholz@g.o>
Subject: Small review on function return codes and simplicity
Date: Tue, 31 Mar 2009 11:05:30 -0700
I noticed some eclass commits using java-pkg_func-exists() and it's a 
lot more complicated than it needs to me. Perhaps not everybody knows 
that bash generally gives a return status from functions of the last 
command run in that function. So these two things are equivalent:

java-pkg_func-exists() {
    if [[ -n "$(declare -f ${1})" ]]; then
        return 0
    else
        return 1
    fi
}


java-pkg_func-exists() {
    [[ -n "$(declare -f ${1})" ]]
}


-- 
Thanks,
Donnie

Donnie Berkholz
Developer, Gentoo Linux
Blog: http://dberkholz.wordpress.com
Attachment:
pgpL2WMFbJAUR.pgp (PGP signature)
Replies:
Re: Small review on function return codes and simplicity
-- Alec Warner
Re: Small review on function return codes and simplicity
-- Ciaran McCreesh
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
RFC: EAPI cheat sheet for your desktop
Next by thread:
Re: Small review on function return codes and simplicity
Previous by date:
Re: sandbox-1.7 and static binaries
Next by date:
Re: Small review on function return codes and simplicity


Updated Jun 17, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.