summaryrefslogtreecommitdiff
path: root/source4/build/pidl/Parse
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-07-19 19:00:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:44 -0500
commitd99d06d954321331f8558da8604e1fd4dd956d13 (patch)
tree052e242ee7d61e658d6ec78b216587143f06565d /source4/build/pidl/Parse
parent8f16aa6c179a6157a4fbece3b30ef6ebfb3f5562 (diff)
downloadsamba-d99d06d954321331f8558da8604e1fd4dd956d13.tar.gz
samba-d99d06d954321331f8558da8604e1fd4dd956d13.tar.bz2
samba-d99d06d954321331f8558da8604e1fd4dd956d13.zip
r8612: Parse::Pidl::NDR:
Values that are deferred but don't contain deferred data don't need NDR_BUFFERS Parse::Pidl::Samba::NDR::Parser: Only use manually written array access functions when the array functions are faster then the autogenerated ones. Makes ndr_basic.c a bit shorter. (This used to be commit cad40815dcfb7cdcab13bd0cd204ef8711605ef3)
Diffstat (limited to 'source4/build/pidl/Parse')
-rw-r--r--source4/build/pidl/Parse/Pidl/NDR.pm5
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm15
2 files changed, 11 insertions, 9 deletions
diff --git a/source4/build/pidl/Parse/Pidl/NDR.pm b/source4/build/pidl/Parse/Pidl/NDR.pm
index 0c2b00539d..33d7839a3a 100644
--- a/source4/build/pidl/Parse/Pidl/NDR.pm
+++ b/source4/build/pidl/Parse/Pidl/NDR.pm
@@ -9,7 +9,7 @@ package Parse::Pidl::NDR;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(GetPrevLevel GetNextLevel);
+@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred);
use strict;
use Parse::Pidl::Typelist qw(hasType getType);
@@ -195,7 +195,6 @@ sub GetElementLevelTable($)
nonfatal($e, "string() attribute on non-array element");
}
-
push (@$order, {
TYPE => "DATA",
DATA_TYPE => $e->{TYPE},
@@ -216,13 +215,13 @@ sub can_contain_deferred
{
my $e = shift;
- return 1 if ($e->{POINTERS});
return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE}));
return 1 unless (hasType($e->{TYPE})); # assume the worst
my $type = getType($e->{TYPE});
foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
+ return 1 if ($x->{POINTERS});
return 1 if (can_contain_deferred ($x));
}
diff --git a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
index c04182ee14..c720ad6925 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
@@ -10,7 +10,7 @@ package Parse::Pidl::Samba::NDR::Parser;
use strict;
use Parse::Pidl::Typelist qw(hasType getType);
use Parse::Pidl::Util qw(has_property ParseExpr);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
# list of known types
my %typefamily;
@@ -55,7 +55,10 @@ sub has_fast_array($$)
return 0 unless ($nl->{TYPE} eq "DATA");
return 0 unless (hasType($nl->{DATA_TYPE}));
- return Parse::Pidl::Typelist::is_scalar($nl->{DATA_TYPE});
+ my $t = getType($nl->{DATA_TYPE});
+
+ # Only uint8 and string have fast array functions at the moment
+ return ($t->{NAME} eq "uint8") or ($t->{NAME} eq "string");
}
sub get_pointer_to($)
@@ -567,7 +570,7 @@ sub ParseElementPushLevel
pidl "}";
}
- if ($deferred and Parse::Pidl::NDR::ContainsDeferred($e, $l)) {
+ if ($deferred and ContainsDeferred($e, $l)) {
pidl "for ($counter = 0; $counter < $length; $counter++) {";
indent;
ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 0, 1);
@@ -590,7 +593,7 @@ sub ParseElementPush($$$$$$)
$var_name = append_prefix($e, $var_name);
- return unless $primitives or ($deferred and Parse::Pidl::NDR::ContainsDeferred($e, $e->{LEVELS}[0]));
+ return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
start_flags($e);
@@ -881,7 +884,7 @@ sub ParseElementPullLevel
}
}
- if ($deferred and Parse::Pidl::NDR::ContainsDeferred($e, $l)) {
+ if ($deferred and ContainsDeferred($e, $l)) {
pidl "for ($counter = 0; $counter < $length; $counter++) {";
indent;
ParseElementPullLevel($e,GetNextLevel($e,$l), $ndr, $var_name, $env, 0, 1);
@@ -903,7 +906,7 @@ sub ParseElementPull($$$$$$)
$var_name = append_prefix($e, $var_name);
- return unless $primitives or ($deferred and Parse::Pidl::NDR::ContainsDeferred($e, $e->{LEVELS}[0]));
+ return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
start_flags($e);