Hugh McMaster : reg: Output the value name and type via a separate function.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 22 09:55:14 CDT 2016


Module: wine
Branch: master
Commit: 904275976707f7c5b0720c9f55909a3f04f1ca65
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=904275976707f7c5b0720c9f55909a3f04f1ca65

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Thu Apr 21 11:45:54 2016 +0000

reg: Output the value name and type via a separate function.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/reg/reg.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index c0afd60..99651f6 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -549,6 +549,16 @@ static const WCHAR *reg_type_to_wchar(DWORD type)
     return NULL;
 }
 
+static void output_value(const WCHAR *value_name, DWORD type)
+{
+    WCHAR fmt[] = {' ',' ',' ',' ','%','1',0};
+    WCHAR newlineW[] = {'\n',0};
+
+    output_string(fmt, value_name);
+    output_string(fmt, reg_type_to_wchar(type));
+    output_string(newlineW);
+}
+
 static int query_all(HKEY key, WCHAR *path)
 {
     LONG rc;
@@ -556,7 +566,6 @@ static int query_all(HKEY key, WCHAR *path)
     DWORD num_values, max_value_len, value_len;
     DWORD i, type;
     WCHAR fmt[] = {'%','1','\n',0};
-    WCHAR fmt_value[] = {' ',' ',' ',' ','%','1',0};
     WCHAR fmt_path[] = {'%','1','\\','%','2','\n',0};
     WCHAR *value_name, *subkey_name;
     WCHAR newlineW[] = {'\n',0};
@@ -584,11 +593,7 @@ static int query_all(HKEY key, WCHAR *path)
         value_len = max_value_len;
         rc = RegEnumValueW(key, i, value_name, &value_len, NULL, &type, NULL, NULL);
         if (rc == ERROR_SUCCESS)
-        {
-            output_string(fmt_value, value_name);
-            output_string(fmt_value, reg_type_to_wchar(type));
-            output_string(newlineW);
-        }
+            output_value(value_name, type);
     }
 
     HeapFree(GetProcessHeap(), 0, value_name);




More information about the wine-cvs mailing list