[gitg/wip/techlivezh/bug/720886: 3/7] Declare variables before the loop



commit 445a75e7bf202e7187640b7f3d2a8d707f16ba6c
Author: Techlive Zheng <techlivezheng gmail com>
Date:   Thu Dec 19 20:41:12 2013 +0800

    Declare variables before the loop

 libgitg/resources/diff-view-html-builder.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/libgitg/resources/diff-view-html-builder.js b/libgitg/resources/diff-view-html-builder.js
index 3f552a0..dc7915a 100644
--- a/libgitg/resources/diff-view-html-builder.js
+++ b/libgitg/resources/diff-view-html-builder.js
@@ -14,9 +14,6 @@ function diff_file(file, lnstate, data)
        {
                var h = file.hunks[i];
 
-               var cold = h.range.old.start;
-               var cnew = h.range.new.start;
-
                var hunk_header = '<span class="hunk_stats">@@ -' + h.range.old.start + ',' + 
h.range.old.lines + ' +' + h.range.new.start + ',' + h.range.new.lines + ' @@</span>';
 
                hunk_header = lnstate.stagebutton + hunk_header;
@@ -27,11 +24,14 @@ function diff_file(file, lnstate, data)
                        <td class="hunk_header">' + hunk_header + '</td> \
                </tr>';
 
+               var l, row, proc;
+               var cold = h.range.old.start;
+               var cnew = h.range.new.start;
                for (var j = 0; j < h.lines.length; ++j)
                {
-                       var l = h.lines[j];
+                       l = h.lines[j];
 
-                       var row = '<tr class="';
+                       row = '<tr class="';
 
                        switch (String.fromCharCode(l.type))
                        {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]