DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 6th February 2014
thirdm thirdm is offline
Spam Deminer
 
Join Date: May 2009
Posts: 248
Default double checks in pkg-config, openbsd

I'm looking at /usr/bin/pkg-config on OpenBSD. Is there a reason to write this ...

Code:
if (defined($ENV{PKG_CONFIG_LIBDIR}) && $ENV{PKG_CONFIG_LIBDIR}) {
	@PKGPATH = split(/:/, $ENV{PKG_CONFIG_LIBDIR});
} elsif (defined($ENV{PKG_CONFIG_PATH}) && $ENV{PKG_CONFIG_PATH}) {
	unshift(@PKGPATH, split(/:/, $ENV{PKG_CONFIG_PATH}));
}
... instead of this ...

Code:
if ($ENV{PKG_CONFIG_LIBDIR}) {
	@PKGPATH = split(/:/, $ENV{PKG_CONFIG_LIBDIR});
} elsif ($ENV{PKG_CONFIG_PATH}) {
	unshift(@PKGPATH, split(/:/, $ENV{PKG_CONFIG_PATH}));
}
?


As far as I can tell, in boolean context a hash entry that doesn't exist will yield false, as will an entry that's there but undef, as will one that's there but one of the other false values (0, "", "0"). Neither does it seem like referring to a non-existent element will either cause a warning or autovivify anything.
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD-5.4::PF config issue Atlantis OpenBSD Security 7 15th February 2014 01:30 PM
OpenBSD 5.3 X server config danielcrvg OpenBSD General 18 20th June 2013 01:03 AM
double nat routing giagni General software and network 5 22nd May 2009 07:10 PM
double posting? ocicat Feedback and Suggestions 6 26th May 2008 12:34 AM
openVPN 2.1_rc7 (server) on openBSD 4.3 config examples s2scott Guides 2 23rd May 2008 06:16 PM


All times are GMT. The time now is 11:40 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick