Closed Bug 729380 Opened 12 years ago Closed 12 years ago

Declaring variables on the beginning of a line confuses cvs diff -p

Categories

(NSS :: Libraries, defect, P3)

3.11.1
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.13.4

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file, 2 obsolete files)

The -p option for cvs diff includes the function names for the diffs.
The function names provide useful context for the diffs.

I noticed that sometimes labels and variable declarations are shown
as function names in cvs diff -p output.  Here is an example:

$ cvs -q diff -p
Index: ssl3con.c
===================================================================
RCS file: /cvsroot/mozilla/security/nss/lib/ssl/ssl3con.c,v
retrieving revision 1.164
diff -u -p -r1.164 ssl3con.c
--- ssl3con.c	17 Feb 2012 09:50:04 -0000	1.164
+++ ssl3con.c	22 Feb 2012 02:23:45 -0000
@@ -2290,7 +2290,7 @@ spec_locked_loser:
 	 * or the caller doesn't want us to send the data yet,
 	 * then add all our new ciphertext to the amount previously saved.
 	 */
-	if ((ss->pendingBuf.len > 0) ||
+	if ((ss->pendingBuf.len > 0) || dummy change 1
 	    (flags & ssl_SEND_FLAG_FORCE_INTO_BUFFER)) {
 
 	    rv = ssl_SaveWriteData(ss, wrBuf->buf, wrBuf->len);
@@ -7063,6 +7063,8 @@ const ssl3KEADef *     kea_def     = ss-
     PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
     PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
 
+    dummy change 2
+
     switch (kea_def->exchKeyType) {
     case kt_rsa:
 	/* Perform SSL Step-Down here. */

I believe this is because those labels and variable declarations start
from the beginning of a line, and cvs diff -p assumes what starts from
the beginning of a line is a function.

I'm not sure if we should require that labels start from column 2, but
we should avoid starting variable declarations from column 0.  The
patch fixes such variable declarations in lib/ssl/ssl3con.c.  It's
clear that they were written that way to align the type names in
variable declarations, but I think the benefit of getting the correct
function names in cvs diff -p output is more important.
Attachment #599439 - Flags: review?(rrelyea)
The previous patch includes unrelated changes to lib/certhigh/ocsp.c.
Sorry about that.
Attachment #599439 - Attachment is obsolete: true
Attachment #599442 - Flags: review?(rrelyea)
Attachment #599439 - Flags: review?(rrelyea)
Comment on attachment 599442 [details] [diff] [review]
Fix variable declarations in lib/ssl/ssl3con.c to not start from column 0 (excludes unrelated changes)

only whitespace changes.

r=kaie
Attachment #599442 - Flags: review?(rrelyea) → review+
I took the opportunity to add an Emacs mode line so that mxr.mozilla.org
will display the TABs in this file correctly (with tab-width=8).  I copied
the Emacs mode line from JavaScript's C files, for example,
http://mxr.mozilla.org/js/source/js/src/js.c

I will report if that works tomorrow.

Patch checked in on the NSS trunk (NSS 3.13.4).

Checking in ssl3con.c;
/cvsroot/mozilla/security/nss/lib/ssl/ssl3con.c,v  <--  ssl3con.c
new revision: 1.165; previous revision: 1.164
done
Attachment #599442 - Attachment is obsolete: true
Attachment #599806 - Flags: review?(kaie)
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: 3.13.3 → 3.13.4
Attachment #599806 - Flags: review?(kaie) → review+
The Emacs tab-width setting is no longer honored by mxr.mozilla.org.  I filed a bug report: bug 729979.
Target Milestone: 3.13.4 → 3.13.5
Target Milestone: 3.13.5 → 3.13.4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: