svn commit: samba r25115 - in branches/SAMBA_4_0/source/script: .

metze at samba.org metze at samba.org
Wed Sep 12 12:36:44 GMT 2007


Author: metze
Date: 2007-09-12 12:36:42 +0000 (Wed, 12 Sep 2007)
New Revision: 25115

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25115

Log:
move normalizing of the define string into a function
and replace '-' with '_' as '-' isn't a string constant in C

jelmer: I assume the "..". for the public header was a bug...

metze
Modified:
   branches/SAMBA_4_0/source/script/mkproto.pl


Changeset:
Modified: branches/SAMBA_4_0/source/script/mkproto.pl
===================================================================
--- branches/SAMBA_4_0/source/script/mkproto.pl	2007-09-12 12:31:19 UTC (rev 25114)
+++ branches/SAMBA_4_0/source/script/mkproto.pl	2007-09-12 12:36:42 UTC (rev 25115)
@@ -68,20 +68,24 @@
 	'help' => \&usage
 ) or exit(1);
 
-if (not defined($public_define) and defined($public_file)) {
-	$public_define = ".." . uc($public_file) . "__";
-	$public_define =~ tr{./}{__};
-} elsif (not defined($public_define)) {
-	$public_define = '_PROTO_H_';
-}
+sub normalize_define($$)
+{
+	my ($define, $file) = @_;
 
-if (not defined($private_define) and defined($private_file)) {
-	$private_define = "__" . uc($private_file) . "__";
-	$private_define =~ tr{./}{__};
-} elsif (not defined($public_define)) {
-	$public_define = '_PROTO_H_';
+	if (not defined($define) and defined($file)) {
+		$define = "__" . uc($file) . "__";
+		$define =~ tr{./}{__};
+		$define =~ tr{\-}{_};
+	} elsif (not defined($define)) {
+		$define = '_PROTO_H_';
+	}
+
+	return $define;
 }
 
+$public_define = normalize_define($public_define, $public_file);
+$private_define = normalize_define($private_define, $private_file);
+
 if ((defined($private_file) and defined($public_file) and ($private_file eq $public_file)) or 
 	(not defined($private_file) and not defined($public_file))) {
 	$private_data = $public_data;



More information about the samba-cvs mailing list