~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to build-aux/useless-if-before-free

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-10-19 00:00:09 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20111019000009-8p33w3wz4b1rdri0
Tags: 1.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
  - Depend on libssl-dev 0.9.8k-7ubuntu4 (LP: #503339)
* Dropped changes, superseded in Debian:
  - Keep build dependencies in main:
    + debian/control: remove info2man build-dep
    + debian/patches/series: disable wget-infopod_generated_manpage
  - Mark wget Multi-Arch: foreign, so packages that aren't of the same arch
    can depend on it.
* Pass --with-ssl=openssl; we don't want to use gnutls, there's no udeb for
  it.
* Add a second build pass for the udeb, so we can build without libidn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl -T
 
1
eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
 
2
  & eval 'exec perl -wST "$0" $argv:q'
 
3
    if 0;
2
4
# Detect instances of "if (p) free (p);".
3
 
# Likewise for "if (p != NULL) free (p);".  And with braces.
4
 
# Also detect "if (NULL != p) free (p);".
5
 
# And with 0 in place of NULL.
 
5
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
6
6
 
7
 
my $VERSION = '2009-04-16 15:57'; # UTC
 
7
my $VERSION = '2011-04-20 13:43'; # UTC
8
8
# The definition above must lie within the first 8 lines in order
9
9
# for the Emacs time-stamp write hook (at end) to update it.
10
10
# If you change this file with Emacs, please let the write hook
11
11
# do its job.  Otherwise, update this string manually.
12
12
 
13
 
# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
13
# Copyright (C) 2008-2011 Free Software Foundation, Inc.
14
14
 
15
15
# This program is free software: you can redistribute it and/or modify
16
16
# it under the terms of the GNU General Public License as published by
61
61
 
62
62
OPTIONS:
63
63
 
64
 
   --list       print only the name of each matching FILE (\0-terminated)
 
64
   --list       print only the name of each matching FILE (\\0-terminated)
65
65
   --name=N     add name N to the list of \`free\'-like functions to detect;
66
66
                  may be repeated
67
67
 
132
132
          while ($line =~
133
133
              /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
134
134
              #  1          2                  3
135
 
               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
 
135
               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
136
136
                \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
137
137
            {
138
138
              my $all = $1;
179
179
git grep -l -z "$free *(" \
180
180
  | xargs -0 useless-if-before-free -l --name="$free" \
181
181
  | xargs -0 perl -0x3b -pi -e \
182
 
   's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
 
182
   's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
183
183
 
184
184
# Use the following to remove redundant uses of kfree inside braces.
185
185
# Note that -0777 puts perl in slurp-whole-file mode;
197
197
EOF
198
198
 
199
199
## Local Variables:
 
200
## mode: perl
200
201
## indent-tabs-mode: nil
201
202
## eval: (add-hook 'write-file-hooks 'time-stamp)
202
203
## time-stamp-start: "my $VERSION = '"