svn commit: samba r4556 - in branches/SAMBA_4_0/source/build/pidl: .
tridge at samba.org
tridge at samba.org
Thu Jan 6 07:22:47 GMT 2005
Author: tridge
Date: 2005-01-06 07:22:47 +0000 (Thu, 06 Jan 2005)
New Revision: 4556
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4556
Log:
neater (and faster) way of doing alignments and scalars
Modified:
branches/SAMBA_4_0/source/build/pidl/util.pm
Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/util.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/util.pm 2005-01-06 07:02:46 UTC (rev 4555)
+++ branches/SAMBA_4_0/source/build/pidl/util.pm 2005-01-06 07:22:47 UTC (rev 4556)
@@ -279,23 +279,41 @@
return bitmap_type_decl($bitmap);
}
+my %type_alignments =
+ (
+ "char" => 1,
+ "int8" => 1,
+ "uint8" => 1,
+ "short" => 2,
+ "wchar_t" => 2,
+ "int16" => 2,
+ "uint16" => 2,
+ "long" => 4,
+ "int32" => 4,
+ "uint32" => 4,
+ "int64" => 4,
+ "uint64" => 4,
+ "NTTIME" => 4,
+ "NTTIME_1sec" => 4,
+ "time_t" => 4,
+ "DATA_BLOB" => 4,
+ "error_status_t" => 4,
+ "WERROR" => 4,
+ "boolean32" => 4,
+ "unsigned32" => 4,
+ "HYPER_T" => 8
+ );
+
sub is_scalar_type($)
{
- my($type) = shift;
+ my $type = shift;
- if ($type =~ /^u?int\d+/) {
+ if (defined $type_alignments{$type}) {
return 1;
}
- if ($type =~ /char|short|long|NTTIME|NTTIME_1sec|
- time_t|error_status_t|boolean32|unsigned32|
- HYPER_T|wchar_t|DATA_BLOB|WERROR/x) {
- return 1;
- }
-
if (is_enum($type)) {
return 1;
}
-
if (is_bitmap($type)) {
return 1;
}
@@ -312,31 +330,10 @@
if (need_wire_pointer($e)) {
return 4;
}
+ if (my $ret = $type_alignments{$type}) {
+ return $ret;
+ }
- return 1, if ($type eq "char");
- return 1, if ($type eq "int8");
- return 1, if ($type eq "uint8");
-
- return 2, if ($type eq "short");
- return 2, if ($type eq "wchar_t");
- return 2, if ($type eq "int16");
- return 2, if ($type eq "uint16");
-
- return 4, if ($type eq "long");
- return 4, if ($type eq "int32");
- return 4, if ($type eq "uint32");
-
- return 4, if ($type eq "int64");
- return 4, if ($type eq "uint64");
-
- return 4, if ($type eq "NTTIME");
- return 4, if ($type eq "NTTIME_1sec");
- return 4, if ($type eq "time_t");
-
- return 4, if ($type eq "DATA_BLOB");
-
- return 8, if ($type eq "HYPER_T");
-
# it must be an external type - all we can do is guess
return 4;
}
More information about the samba-cvs
mailing list