From 95b8ab07f048c43f4e74dedb1b84a865a8503936 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 12 Sep 2007 12:36:42 +0000 Subject: 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) --- source4/script/mkproto.pl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'source4/script/mkproto.pl') 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; -- cgit