Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Don't use dangling elses.
details: https://anonhg.NetBSD.org/src/rev/7d6bc7713232
branches: trunk
changeset: 772515:7d6bc7713232
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Jan 06 15:16:02 2012 +0000
description:
Don't use dangling elses.
diffstat:
external/gpl2/xcvs/dist/diff/diff3.c | 6 ++++++
external/gpl2/xcvs/dist/diff/side.c | 2 ++
gnu/dist/gcc4/libstdc++-v3/include/bits/stl_tree.h | 2 ++
gnu/dist/gcc4/libstdc++-v3/src/strstream.cc | 2 ++
gnu/dist/gcc4/libstdc++-v3/src/tree.cc | 8 ++++++--
gnu/dist/groff/src/roff/troff/input.cpp | 5 +++--
gnu/dist/groff/src/roff/troff/mtsm.cpp | 11 +++++++----
gnu/dist/groff/src/roff/troff/node.cpp | 5 +++--
gnu/usr.bin/rcs/ci/ci.c | 8 ++++++--
gnu/usr.bin/rcs/ident/ident.c | 9 ++++++---
gnu/usr.bin/rcs/lib/rcsbase.h | 13 ++++++++-----
gnu/usr.bin/rcs/lib/rcsedit.c | 17 ++++++++++++-----
gnu/usr.bin/rcs/lib/rcsgen.c | 8 ++++++--
gnu/usr.bin/rcs/lib/rcsrev.c | 8 ++++++--
gnu/usr.bin/rcs/rcs/rcs.c | 17 ++++++++++++-----
gnu/usr.bin/rcs/rcsdiff/rcsdiff.c | 8 ++++++--
gnu/usr.bin/rcs/rlog/rlog.c | 11 ++++++++---
17 files changed, 101 insertions(+), 39 deletions(-)
diffs (truncated from 648 to 300 lines):
diff -r d789658ae309 -r 7d6bc7713232 external/gpl2/xcvs/dist/diff/diff3.c
--- a/external/gpl2/xcvs/dist/diff/diff3.c Fri Jan 06 15:15:27 2012 +0000
+++ b/external/gpl2/xcvs/dist/diff/diff3.c Fri Jan 06 15:16:02 2012 +0000
@@ -1556,10 +1556,12 @@
{
write_output (".\n", 2);
if (leading_dot)
+ {
if (num == 1)
printf_output ("%ds/^\\.//\n", start);
else
printf_output ("%d,%ds/^\\.//\n", start, start + num - 1);
+ }
}
/*
@@ -1751,10 +1753,12 @@
{
c = getc (infile);
if (c == EOF)
+ {
if (ferror (infile))
diff3_perror_with_exit ("input file");
else if (feof (infile))
diff3_fatal ("input file shrank");
+ }
cc = c;
write_output (&cc, 1);
}
@@ -1805,6 +1809,7 @@
while (0 <= --i)
while ((c = getc (infile)) != '\n')
if (c == EOF)
+ {
if (ferror (infile))
diff3_perror_with_exit ("input file");
else if (feof (infile))
@@ -1813,6 +1818,7 @@
diff3_fatal ("input file shrank");
return conflicts_found;
}
+ }
}
/* Copy rest of common file. */
while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile)))
diff -r d789658ae309 -r 7d6bc7713232 external/gpl2/xcvs/dist/diff/side.c
--- a/external/gpl2/xcvs/dist/diff/side.c Fri Jan 06 15:15:27 2012 +0000
+++ b/external/gpl2/xcvs/dist/diff/side.c Fri Jan 06 15:16:02 2012 +0000
@@ -123,6 +123,7 @@
case '\b':
if (in_position != 0 && --in_position < out_bound)
+ {
if (out_position <= in_position)
/* Add spaces to make up for suppressed tab past out_bound. */
for (; out_position < in_position; out_position++)
@@ -133,6 +134,7 @@
cc = c;
write_output (&cc, 1);
}
+ }
break;
case '\f':
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/gcc4/libstdc++-v3/include/bits/stl_tree.h
--- a/gnu/dist/gcc4/libstdc++-v3/include/bits/stl_tree.h Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/gcc4/libstdc++-v3/include/bits/stl_tree.h Fri Jan 06 15:16:02 2012 +0000
@@ -923,10 +923,12 @@
}
iterator __j = iterator(__y);
if (__comp)
+ {
if (__j == begin())
return pair<iterator,bool>(_M_insert(__x, __y, __v), true);
else
--__j;
+ }
if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
return pair<iterator, bool>(_M_insert(__x, __y, __v), true);
return pair<iterator, bool>(__j, false);
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/gcc4/libstdc++-v3/src/strstream.cc
--- a/gnu/dist/gcc4/libstdc++-v3/src/strstream.cc Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/gcc4/libstdc++-v3/src/strstream.cc Fri Jan 06 15:16:02 2012 +0000
@@ -311,10 +311,12 @@
strstreambuf::_M_free(char* p)
{
if (p)
+ {
if (_M_free_fun)
_M_free_fun(p);
else
delete[] p;
+ }
}
void
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/gcc4/libstdc++-v3/src/tree.cc
--- a/gnu/dist/gcc4/libstdc++-v3/src/tree.cc Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/gcc4/libstdc++-v3/src/tree.cc Fri Jan 06 15:16:02 2012 +0000
@@ -315,18 +315,22 @@
__z->_M_parent->_M_left = __x;
else
__z->_M_parent->_M_right = __x;
- if (__leftmost == __z)
+ if (__leftmost == __z)
+ {
if (__z->_M_right == 0) // __z->_M_left must be null also
__leftmost = __z->_M_parent;
// makes __leftmost == _M_header if __z == __root
else
__leftmost = _Rb_tree_node_base::_S_minimum(__x);
- if (__rightmost == __z)
+ }
+ if (__rightmost == __z)
+ {
if (__z->_M_left == 0) // __z->_M_right must be null also
__rightmost = __z->_M_parent;
// makes __rightmost == _M_header if __z == __root
else // __x == __z->_M_left
__rightmost = _Rb_tree_node_base::_S_maximum(__x);
+ }
}
if (__y->_M_color != _S_red)
{
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/groff/src/roff/troff/input.cpp
--- a/gnu/dist/groff/src/roff/troff/input.cpp Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/groff/src/roff/troff/input.cpp Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: input.cpp,v 1.1.1.3 2006/02/06 18:14:11 wiz Exp $ */
+/* $NetBSD: input.cpp,v 1.2 2012/01/06 15:16:03 joerg Exp $ */
// -*- C++ -*-
/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005
@@ -2798,11 +2798,12 @@
do {
node *n;
cc = get_copy(&n);
- if (cc != EOF)
+ if (cc != EOF) {
if (cc != '\0')
curdiv->transparent_output(transparent_translate(cc));
else
curdiv->transparent_output(n);
+ }
} while (cc != '\n' && cc != EOF);
if (cc == EOF)
curdiv->transparent_output('\n');
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/groff/src/roff/troff/mtsm.cpp
--- a/gnu/dist/groff/src/roff/troff/mtsm.cpp Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/groff/src/roff/troff/mtsm.cpp Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mtsm.cpp,v 1.2 2010/05/06 18:54:35 drochner Exp $ */
+/* $NetBSD: mtsm.cpp,v 1.3 2012/01/06 15:16:03 joerg Exp $ */
// -*- C++ -*-
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
@@ -484,21 +484,24 @@
void statem::display_state()
{
fprintf(stderr, " <state ");
- if (bool_values[MTSM_BR].is_known)
+ if (bool_values[MTSM_BR].is_known) {
if (bool_values[MTSM_BR].value)
fprintf(stderr, "[br]");
else
fprintf(stderr, "[!br]");
- if (bool_values[MTSM_EOL].is_known)
+ }
+ if (bool_values[MTSM_EOL].is_known) {
if (bool_values[MTSM_EOL].value)
fprintf(stderr, "[eol]");
else
fprintf(stderr, "[!eol]");
- if (int_values[MTSM_SP].is_known)
+ }
+ if (int_values[MTSM_SP].is_known) {
if (int_values[MTSM_SP].value)
fprintf(stderr, "[sp %d]", int_values[MTSM_SP].value);
else
fprintf(stderr, "[!sp]");
+ }
fprintf(stderr, ">");
fflush(stderr);
}
diff -r d789658ae309 -r 7d6bc7713232 gnu/dist/groff/src/roff/troff/node.cpp
--- a/gnu/dist/groff/src/roff/troff/node.cpp Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/dist/groff/src/roff/troff/node.cpp Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: node.cpp,v 1.1.1.3 2006/02/06 18:14:14 wiz Exp $ */
+/* $NetBSD: node.cpp,v 1.2 2012/01/06 15:16:03 joerg Exp $ */
// -*- C++ -*-
/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005
@@ -4602,7 +4602,7 @@
}
else {
hunits rem = x - w*i;
- if (rem > H0)
+ if (rem > H0) {
if (n->overlaps_horizontally()) {
if (out->is_on())
n->tprint(out);
@@ -4610,6 +4610,7 @@
}
else
out->right(rem);
+ }
while (--i >= 0)
if (out->is_on())
n->tprint(out);
diff -r d789658ae309 -r 7d6bc7713232 gnu/usr.bin/rcs/ci/ci.c
--- a/gnu/usr.bin/rcs/ci/ci.c Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/usr.bin/rcs/ci/ci.c Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ci.c,v 1.4 1996/10/15 06:59:54 veego Exp $ */
+/* $NetBSD: ci.c,v 1.5 2012/01/06 15:16:03 joerg Exp $ */
/* Check in revisions of RCS files from working files. */
@@ -31,6 +31,9 @@
/*
* $Log: ci.c,v $
+ * Revision 1.5 2012/01/06 15:16:03 joerg
+ * Don't use dangling elses.
+ *
* Revision 1.4 1996/10/15 06:59:54 veego
* Merge rcs 5.7.
*
@@ -1141,7 +1144,7 @@
num=delta->num;
for (trail = &Locks; (next = *trail); trail = &next->nextlock)
- if (next->delta == delta)
+ if (next->delta == delta) {
if (strcmp(getcaller(), next->login) == 0) {
/* We found a lock on delta by caller; delete it. */
*trail = next->nextlock;
@@ -1151,6 +1154,7 @@
rcserror("revision %s locked by %s", num, next->login);
return -1;
}
+ }
if (!StrictLocks && myself(RCSstat.st_uid))
return 0;
rcserror("no lock set by %s for revision %s", getcaller(), num);
diff -r d789658ae309 -r 7d6bc7713232 gnu/usr.bin/rcs/ident/ident.c
--- a/gnu/usr.bin/rcs/ident/ident.c Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/usr.bin/rcs/ident/ident.c Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ident.c,v 1.5 2006/03/26 22:50:48 christos Exp $ */
+/* $NetBSD: ident.c,v 1.6 2012/01/06 15:16:03 joerg Exp $ */
/* Identify RCS keyword strings in files. */
/* Copyright 1982, 1988, 1989 Walter Tichy
@@ -30,6 +30,9 @@
/*
* $Log: ident.c,v $
+ * Revision 1.6 2012/01/06 15:16:03 joerg
+ * Don't use dangling elses.
+ *
* Revision 1.5 2006/03/26 22:50:48 christos
* Coverity CID 1202: Always return on EOF, otherwise we would try to use
* ctab[-1].
@@ -142,7 +145,7 @@
break;
}
- if (0 <= quiet)
+ if (0 <= quiet) {
if (!a)
VOID scanfile(stdin, (char*)0, quiet);
else
@@ -156,7 +159,7 @@
)
break;
} while ((a = *++argv));
-
+ }
if (ferror(stdout) || fclose(stdout)!=0) {
reportError("standard output");
status = EXIT_FAILURE;
diff -r d789658ae309 -r 7d6bc7713232 gnu/usr.bin/rcs/lib/rcsbase.h
--- a/gnu/usr.bin/rcs/lib/rcsbase.h Fri Jan 06 15:15:27 2012 +0000
+++ b/gnu/usr.bin/rcs/lib/rcsbase.h Fri Jan 06 15:16:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rcsbase.h,v 1.9 1998/09/14 18:36:07 tv Exp $ */
+/* $NetBSD: rcsbase.h,v 1.10 2012/01/06 15:16:03 joerg Exp $ */
/* RCS common definitions and data structures */
@@ -33,6 +33,9 @@
/*
* $Log: rcsbase.h,v $
+ * Revision 1.10 2012/01/06 15:16:03 joerg
+ * Don't use dangling elses.
+ *
* Revision 1.9 1998/09/14 18:36:07 tv
Home |
Main Index |
Thread Index |
Old Index