diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-09-12 12:36:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:06:42 -0500 |
commit | 95b8ab07f048c43f4e74dedb1b84a865a8503936 (patch) | |
tree | db0807598cf0b464a933980973bf6b3deb28182d | |
parent | e8712bebae30f4f041643ce36177a321f12c23e5 (diff) | |
download | samba-95b8ab07f048c43f4e74dedb1b84a865a8503936.tar.gz samba-95b8ab07f048c43f4e74dedb1b84a865a8503936.tar.bz2 samba-95b8ab07f048c43f4e74dedb1b84a865a8503936.zip |
r25115: 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
(This used to be commit 5522ee146151603e64e0fc26fc8c900b0403c883)
-rwxr-xr-x | source4/script/mkproto.pl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index f09d99243f..5c4f71e8a4 100755 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -68,20 +68,24 @@ GetOptions( '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($define) and defined($file)) { + $define = "__" . uc($file) . "__"; + $define =~ tr{./}{__}; + $define =~ tr{\-}{_}; + } elsif (not defined($define)) { + $define = '_PROTO_H_'; + } -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_'; + 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; |