[gnome-commander] noop: code cleanup



commit 28b8937a4e61fda6564ce864ae9fb6552e535c0e
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Jan 9 20:00:28 2012 +0100

    noop: code cleanup

 src/intviewer/viewer-utils.cc    |   10 ++++------
 tests/gviewer/bm_chartype_test.c |   17 ++++++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/src/intviewer/viewer-utils.cc b/src/intviewer/viewer-utils.cc
index c73c5d5..12d16f9 100644
--- a/src/intviewer/viewer-utils.cc
+++ b/src/intviewer/viewer-utils.cc
@@ -105,19 +105,17 @@ char_type *convert_utf8_to_chartype_array (const gchar *utf8text, /*out*/ int *a
 
     g_return_val_if_fail (g_utf8_validate(utf8text, -1, NULL), NULL);
 
-    glong index;
     guint32 unicode_char;
-    const gchar *pos;
-    char_type *result;
 
     glong length = g_utf8_strlen(utf8text, -1);
     g_return_val_if_fail (length>0, NULL);
 
-    result = g_new0 (char_type, length);
     *array_length = length;
+    char_type *result = g_new0 (char_type, length);
 
-    pos = utf8text;
-    for (index=0; index<length; ++index)
+    const gchar *pos = utf8text;
+
+    for (glong index=0; index<length; ++index)
     {
         unicode_char = g_utf8_get_char(pos);
 
diff --git a/tests/gviewer/bm_chartype_test.c b/tests/gviewer/bm_chartype_test.c
index 7c9dea0..3b89618 100644
--- a/tests/gviewer/bm_chartype_test.c
+++ b/tests/gviewer/bm_chartype_test.c
@@ -30,11 +30,11 @@
 void print_badchar(gpointer key, gpointer value, gpointer user_data)
 {
     printf("%02x %02x %02x %02x\t%d\n",
-        GV_FIRST_BYTE((guint32)key),
-        GV_SECOND_BYTE((guint32)key),
-        GV_THIRD_BYTE((guint32)key),
-        GV_FOURTH_BYTE((guint32)key),
-        (guint32)value);
+           GV_FIRST_BYTE((guint32)key),
+           GV_SECOND_BYTE((guint32)key),
+           GV_THIRD_BYTE((guint32)key),
+           GV_FOURTH_BYTE((guint32)key),
+           (guint32)value);
 }
 
 int main()
@@ -94,9 +94,12 @@ int main()
     m = data->pattern_len;
     n = ct_text_len;
     j = 0;
-    while (j <= n - m) {
+    while (j <= n - m)
+    {
         for (i = m - 1; i >= 0 && bm_chartype_equal(data,i,ct_text[i + j]); --i);
-        if (i < 0) {
+
+        if (i < 0)
+        {
             printf(" Found match at offset = %d\n", j);
             j += bm_chartype_get_good_match_advancement(data);
         }



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