mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
update from gnulib
* build-aux/mktempd (rand_bytes, mktempd): * build-aux/useless-if-before-free (FILE): * build-aux/vc-list-files: * gnulib/lib/.cvsignore: * gnulib/lib/Makefile.am: * gnulib/lib/poll.c (poll): * gnulib/lib/stdbool.in.h (_GL_STDBOOL_H, true): * gnulib/lib/stdio-impl.h (fp_, fp_ub): * gnulib/lib/stdio.in.h (vasprintf, obstack_printf) (obstack_vprintf): * gnulib/lib/vasnprintf.c (_GNU_SOURCE, sprintf, IF_LINT, exp) (remainder, scale10_round_decimal_long_double) (scale10_round_decimal_double, pad_ourselves): * gnulib/m4/gnulib-cache.m4: * gnulib/m4/gnulib-common.m4 (gl_MODULE_INDICATOR): * gnulib/m4/gnulib-tool.m4 (gl_LOCAL_DIR, gl_M4_BASE, gl_PO_BASE) (gl_DOC_BASE, gl_TESTS_BASE, gl_WITH_TESTS, gl_LIB, gl_LGPL) (gl_MAKEFILE_NAME, gl_MACRO_PREFIX, gl_PO_DOMAIN, gl_VC_FILES): * gnulib/m4/lock.m4 (gl_LOCK_EARLY_BODY, gl_PREREQ_LOCK) (gl_DISABLE_THREADS): * gnulib/m4/onceonly.m4: * gnulib/m4/posix-shell.m4 (gl_POSIX_SHELL): * gnulib/m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): * gnulib/tests/test-getaddrinfo.c (ENABLE_DEBUGGING, dbgprintf) (simple): * gnulib/tests/test-stdint.c (UINTMAX_MAX, or): * gnulib/tests/test-vc-list-files-cvs.sh (compare): * gnulib/tests/test-vc-list-files-git.sh (compare):
This commit is contained in:
@@ -44,7 +44,7 @@ rand_bytes()
|
||||
dev_rand=/dev/urandom
|
||||
if test -r "$dev_rand"; then
|
||||
# Note: 256-length($chars) == 194; 3 copies of $chars is 186 + 8 = 194.
|
||||
head -c$n "$dev_rand" | tr -c $chars 01234567$chars$chars$chars
|
||||
dd ibs=$n count=1 if="$dev_rand" | tr -c $chars 01234567$chars$chars$chars
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -114,7 +114,9 @@ mktempd()
|
||||
base_template=`echo "$template"|sed 's/XX*$//'`
|
||||
|
||||
# Calculate how many X's we've just removed.
|
||||
nx=`expr length "$template" - length "$base_template"`
|
||||
template_length=`echo "$template" | wc -c`
|
||||
nx=`echo "$base_template" | wc -c`
|
||||
nx=`expr $template_length - $nx`
|
||||
|
||||
err=
|
||||
i=1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Detect instances of "if (p) free (p);".
|
||||
# Likewise for "if (p != NULL) free (p);". And with braces.
|
||||
|
||||
my $VERSION = '2008-05-01 19:11'; # UTC
|
||||
my $VERSION = '2008-05-25 17:36'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
@@ -122,14 +122,22 @@ EOF
|
||||
while (defined (my $line = <FH>))
|
||||
{
|
||||
while ($line =~
|
||||
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)\s*;\s*\}))/sxg)
|
||||
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*NULL)?\s*\)
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $1\n";
|
||||
# Compare "if" expression and free'd expression,
|
||||
# without regard to white space.
|
||||
(my $e1 = $2) =~ tr/ \t//d;
|
||||
my $e2 = defined $3 ? $3 : $4;
|
||||
$e2 =~ tr/ \t//d;
|
||||
if ($e1 eq $e2)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $1\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,12 +157,12 @@ my $foo = <<'EOF';
|
||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||
|
||||
# FIXME: do something like this as an option (doesn't do braces):
|
||||
git ls-files -z |xargs -0 \
|
||||
perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(k?free\s*\(\s*\1\s*\))/$2/s'
|
||||
|
||||
useless-if-before-free -l $(lid -knone free) | xargs -0 \
|
||||
perl -0x3b -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s'
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
|
||||
|
||||
# Or, with git:
|
||||
git ls-files -z |xargs -0 perl -0x3b -pi -e '...'
|
||||
|
||||
Be careful that the result of the above transformation is valid.
|
||||
If the matched string is followed by "else", then obviously, it won't be.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2008-05-01.10
|
||||
scriptversion=2008-07-11.19
|
||||
|
||||
# Copyright (C) 2006-2008 Free Software Foundation, Inc.
|
||||
|
||||
@@ -88,7 +88,8 @@ elif test -d CVS; then
|
||||
eval awk -F/ \''{ \
|
||||
if (!$1 && $3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
sub(/CVS\/Entries/, "", f); \
|
||||
if (f ~ /CVS\/Entries$/) \
|
||||
f = substr(f, 0, length(f)-11); \
|
||||
print f $2; \
|
||||
}}'\'' \
|
||||
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
||||
|
||||
Reference in New Issue
Block a user