summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-05 12:56:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:36:51 -0500
commit362d4b14aecb32aac5c7c4f6beb3b9a979bf9d5a (patch)
tree4c0b015dd964ef671acb9c29b5832a497e38e452 /source4/pidl/lib/Parse/Pidl
parent34040b420a77ac144db99606369d4ed636cdf750 (diff)
downloadsamba-362d4b14aecb32aac5c7c4f6beb3b9a979bf9d5a.tar.gz
samba-362d4b14aecb32aac5c7c4f6beb3b9a979bf9d5a.tar.bz2
samba-362d4b14aecb32aac5c7c4f6beb3b9a979bf9d5a.zip
r20543: Merge some pidl bug fixes:
* C expressions that just started with a constant were erroneously flagged as being a constant. * 1-length variable names in expressions were broken. (This used to be commit 44775a6ac456247fe7ab4da75498bb550c74c854)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Util.pm18
1 files changed, 7 insertions, 11 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm
index ff615a21ba..f1a97693a7 100644
--- a/source4/pidl/lib/Parse/Pidl/Util.pm
+++ b/source4/pidl/lib/Parse/Pidl/Util.pm
@@ -26,12 +26,9 @@ sub MyDumper($)
# see if a pidl property list contains a given property
sub has_property($$)
{
- my($e) = shift;
- my($p) = shift;
+ my($e, $p) = @_;
- if (!defined $e->{PROPERTIES}) {
- return undef;
- }
+ return undef if (not defined($e->{PROPERTIES}));
return $e->{PROPERTIES}->{$p};
}
@@ -40,9 +37,7 @@ sub has_property($$)
# see if a pidl property matches a value
sub property_matches($$$)
{
- my($e) = shift;
- my($p) = shift;
- my($v) = shift;
+ my($e,$p,$v) = @_;
if (!defined has_property($e, $p)) {
return undef;
@@ -59,7 +54,7 @@ sub property_matches($$$)
sub is_constant($)
{
my $s = shift;
- if (defined $s && $s =~ /^\d/) {
+ if (defined $s && $s =~ /^\d$/) {
return 1;
}
return 0;
@@ -72,7 +67,7 @@ sub make_str($)
if (substr($str, 0, 1) eq "\"") {
return $str;
}
- return "\"" . $str . "\"";
+ return "\"$str\"";
}
sub print_uuid($)
@@ -80,6 +75,7 @@ sub print_uuid($)
my ($uuid) = @_;
$uuid =~ s/"//g;
my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
+ return undef if not defined($node);
my @clock_seq = $clock_seq =~ /(..)/g;
my @node = $node =~ /(..)/g;
@@ -106,7 +102,7 @@ sub ParseExpr($$)
die("Undefined value in ParseExpr") if not defined($expr);
- my @tokens = split /((?:[A-Za-z_])(?:(?:(?:[A-Za-z0-9_.])|(?:->))+))/, $expr;
+ my @tokens = split /((?:[A-Za-z_])(?:(?:(?:[A-Za-z0-9_.])|(?:->))+)?)/, $expr;
my $ret = "";
foreach my $t (@tokens) {