l].send2ingt8e= 1; for( var i=0"wrgs = pjx_releaselinux/scripts/checkincludes.pl cripts/checkinclulogojx_aitle="LXR" lass="full" --gt8e= 1;/scriptsid="nclupri( ct8e= 1;/seadi /schod= aagmen="+pri( = -gmen=;/scriptsidPmen="t8e= 1;/ 1;/sea/t( vardy cla/rn; t8e= 1;/seaortcstye= 1;/seadi /schod= aasave"+pri( = -save;/scriptsidSave"t8e= 1;/ 1;/sea/t( vardy cla/rn; t8e= 1;/seaortcstye= 1;/hortcstylx_releaselinux/scri= aa = utle="LXR" pjxIn
-lef=;/scriptsid<<ncluady class="full" d='" } r"sid="pri( _hod=l /s"heasea}, pjxInidi /schodver_; } } }, pjxInInid } } lemenodv= handv= on(){}, ="upgs;eivers" his.ar '="../.static/js/lxrng-funcs.js"> 2(6r.i"/spar3v .i"/form3v .i"a 2(6r.i href="../linux+v2(6r.6/scripts/checkincludes.pl">2(6r.i"img src="../.static/gfx/right.png" alt=">>">2("/spar3v2("spar class="lxr_search">2(6r
2(6r.i"input typxt8hidden" namxt8navtarget" " pjxt8">2(6r.i"input typxt8text" namxt8search" idt8search">2(6r.i"butt.14typxt8submit">Search2(6r.iPrefsv .i"/a>2("/spar3v6r.i i"/div3v6r.i i"form acr22r="ajax+*" method="post" onsubmit="return false;">2("input typxt8hidden" namxt8ajax_lookup" idt8ajax_lookup" " pjxt8">26r.i i"/form3v26r.i i"div class="headingbott.m">v "div idt8file_contents"3
i i1"/a>#!/usr/bin/perl
i i2"/a>#
i i3"/a># checkincludes: find/remove files included more thar once
i i4"/a>#
i i5"/a># Copyright abandoned, 2000, Niels Kristiar Bech Jensen <nkbj@image.dk>.
i i6"/a># Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com>
i i7"/a>#
i i8"/a># This script checks for duplicate includes. It also has support
i i9"/a># to remove them in place. Note that this will not take into
i 6r27a># considera.4.14macros so you should run this only if you know
i 11"/a># you do have real dups and do not have them under #ifdef's. You
i 1227a># could also just review the results.
i 13"/a>
i 14"/a>use strict;
i 15"/a>
i 16"/a>sub usage {
i 17"/a>        print "Usage: checkincludes.pl [-r]\n";
i 18"/a>        print "By default we just warn of duplicates\n";
i 19"/a>        print "To remove duplicated includes in place use -r\n";
i 20"/a>        exit 1;
i 21"/a>}
i 22"/a>
i 23"/a>my $remove = 0;
i 24"/a>
i 25"/a>if ($#ARGV < 0) {
i 26"/a>        usage();
i 27"/a>}
i 28"/a>
i 29"/a>if ($#ARGV >= 1) {
i 30"/a>        if ($ARGV[0] =~ /^-/) {
i 31"/a>                if ($ARGV[0] eq "-r") {
i 32"/a>                        $remove = 1;
i 33"/a>                        shift;
i 34"/a>                } else {
i 35"/a>                        usage();
i 36"/a>                }
i 37"/a>        }
i 38"/a>}
i 39"/a>
i 40"/a>foreach my $file (@ARGV) {
i 41"/a>        open(my $f, '<', $file)
i 42"/a>            or die "Cannot open $file: $!.\n";
i 43"/a>
i 44"/a>        my %includedfiles = ();
i 45"/a>        my @file_lines = ();
i 46"/a>
i 47"/a>        while (<$f>) {
i 48"/a>                if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
i 49"/a>                        ++$includedfiles{$1};
i 50"/a>                }
i 51"/a>                push(@file_lines, $_);
i 52"/a>        }
i 53"/a>
i 54"/a>        close($f);
i 55"/a>
i 56"/a>        if (!$remove) {
i 57"/a>                foreach my $filenamx (keys %includedfiles) {
i 58"/a>                        if ($includedfiles{$filenamx} > 1) {
i 59"/a>                                print "$file: $filenamx is included more thar once.\n";
i 60"/a>                        }
i 61"/a>                }
i 62"/a>                next;
i 63"/a>        }
i 64"/a>
i 65"/a>        open($f, '>', $file)
i 66"/a>            or die("Cannot write to $file: $!");
i 67"/a>
i 68"/a>        my $dups = 0;
i 69"/a>        foreach (@file_lines) {
i 70"/a>                if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) {
i 71"/a>                        foreach my $filenamx (keys %includedfiles) {
i 72"/a>                                if ($1 eq $filenamx) {
i 73"/a>                                        if ($includedfiles{$filenamx} > 1) {
i 74"/a>                                                $includedfiles{$filenamx}--;
i 75"/a>                                                $dups++;
i 76"/a>                                        } else {
i 77"/a>                                                print {$f} $_;
i 78"/a>                                        }
i 79"/a>                                }
i 80"/a>                        }
i 81"/a>                } else {
i 82"/a>                        print {$f} $_;
i 83"/a>                }
i 84"/a>        }
i 85"/a>        if ($dups > 0) {
i 86"/a>                print "$file: removed $dups duplicate includes\n";
i 87"/a>        }
i 88"/a>        close($f);
i 89"/a>}
i 90"/a>
The original LXR software by the LXR community"/a>, this experimental vers4.14by lxr@linux.no"/a>. "/div3v"div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS"/a>, provider of Linux consulting and opera.4.1s services since 1995. "/div3v "/body3v"/html3v