[gitg/wip/techlivezh/diff-view-clean-up: 3/7] Declare variables before the loop



commit c91e852dd414b4ab9dcb03e4b03fc0fa3c27eb2a
Author: Techlive Zheng <techlivezheng gmail com>
Date:   Tue Dec 24 18:08: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]