changed a few variable names

This commit is contained in:
hyung-hwan 2015-01-28 02:58:49 +00:00
parent 58bb110c92
commit 7dabb672e3

View File

@ -135,12 +135,14 @@ function format_diff ($a, $b, $css_class)
{ {
if ($b == '') return htmlspecialchars($a); if ($b == '') return htmlspecialchars($a);
// TODO: word by word comparison to be less position dependent
$cc = ''; $cc = '';
$diffstart = -1; $diffstart = -1;
$aalen = strlen($a); $alen = strlen($a);
$bblen = strlen($b); $blen = strlen($b);
for ($i = 0; $i < $aalen && $i < $bblen; $i++) for ($i = 0; $i < $alen && $i < $blen; $i++)
{ {
if ($a[$i] == $b[$i]) if ($a[$i] == $b[$i])
{ {
@ -162,14 +164,14 @@ function format_diff ($a, $b, $css_class)
if ($diffstart >= 0) if ($diffstart >= 0)
{ {
$cc .= sprintf ('<span class="%s">', $css_class); $cc .= sprintf ('<span class="%s">', $css_class);
$cc .= htmlspecialchars(substr($a, $diffstart, $aalen - $diffstart)); $cc .= htmlspecialchars(substr($a, $diffstart, $alen - $diffstart));
$cc .= '</span>'; $cc .= '</span>';
} }
else else
{ {
if ($aalen > $bblen) if ($alen > $blen)
{ {
$cc .= htmlspecialchars(substr ($a, $aalen, $aalen - $bblen)); $cc .= htmlspecialchars(substr ($a, $alen, $alen - $blen));
} }
} }