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

RESOLVED FIXED in 3.13.4

Status

NSS
Libraries
P3
trivial
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Wan-Teh Chang, Assigned: Wan-Teh Chang)

Tracking

3.11.1
3.13.4

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

6 years ago
Created attachment 599439 [details] [diff] [review]
Fix variable declarations in lib/ssl/ssl3con.c to not start from column 0

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)
(Assignee)

Comment 1

6 years ago
Created attachment 599442 [details] [diff] [review]
Fix variable declarations in lib/ssl/ssl3con.c to not start from column 0 (excludes unrelated changes)

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 2

6 years ago
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+
(Assignee)

Comment 3

6 years ago
Created attachment 599806 [details] [diff] [review]
Fix variable declarations in lib/ssl/ssl3con.c to not start from column 0, v2

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)
(Assignee)

Updated

6 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: 3.13.3 → 3.13.4

Updated

6 years ago
Attachment #599806 - Flags: review?(kaie) → review+
(Assignee)

Comment 4

6 years ago
The Emacs tab-width setting is no longer honored by mxr.mozilla.org.  I filed a bug report: bug 729979.
(Assignee)

Updated

6 years ago
Target Milestone: 3.13.4 → 3.13.5
(Assignee)

Updated

6 years ago
Target Milestone: 3.13.5 → 3.13.4
You need to log in before you can comment on or make changes to this bug.