[dw-free] avoid uninitialized warnings in LJ/Lang.pm
[commit: http://hg.dwscoalition.org/dw-free/rev/1717049f6c65]
http://bugs.dwscoalition.org/show_bug.cgi?id=3326
Return early, if we didn't pass in an argument to process.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3326
Return early, if we didn't pass in an argument to process.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/Lang.pm
-------------------------------------------------------------------------------- diff -r 8bed8122b87e -r 1717049f6c65 cgi-bin/LJ/Lang.pm --- a/cgi-bin/LJ/Lang.pm Fri Dec 10 17:53:38 2010 +0800 +++ b/cgi-bin/LJ/Lang.pm Fri Dec 10 18:01:45 2010 +0800 @@ -110,30 +110,30 @@ sub set_error return 0; } -sub get_lang -{ - my $code = shift; +sub get_lang { + my $code = $_[0]; + return unless defined $code; load_lang_struct() unless $LS_CACHED; return $LN_CODE{$code}; } -sub get_lang_id -{ - my $id = shift; +sub get_lang_id { + my $id = $_[0]; + return unless defined $id; load_lang_struct() unless $LS_CACHED; return $LN_ID{$id}; } -sub get_dom -{ - my $dmcode = shift; +sub get_dom { + my $dmcode = $_[0]; + return unless defined $dmcode; load_lang_struct() unless $LS_CACHED; return $DM_UNIQ{$dmcode}; } -sub get_dom_id -{ - my $dmid = shift; +sub get_dom_id { + my $dmid = $_[0]; + return unless defined $dmid; load_lang_struct() unless $LS_CACHED; return $DM_ID{$dmid}; } @@ -533,7 +533,8 @@ sub string_exists { # -- this function will tell you if the value is one of # those values. gross. sub is_missing_string { - my $string = shift; + my $string = $_[0]; + return 1 unless defined $string; return ( $string eq "" || $string =~ /^\[missing string/ || --------------------------------------------------------------------------------