]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid compilation warning in w32fns.c
authorEli Zaretskii <eliz@gnu.org>
Sat, 18 Aug 2018 06:24:38 +0000 (09:24 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 18 Aug 2018 06:24:38 +0000 (09:24 +0300)
* src/w32fns.c (Fw32_read_registry): Avoid compiler warning
regarding possible use of 'rootkey' without initializing it
first.  Reported by Andy Moreton <andrewjmoreton@gmail.com>.

src/w32fns.c

index c32868fa695377ff0da9726e7ef5baf1d1c5e938..b587677f090b7eaefc2d971a57b3927305666f69 100644 (file)
@@ -10125,7 +10125,7 @@ to be converted to forward slashes by the caller.  */)
   CHECK_STRING (key);
   CHECK_STRING (name);
 
-  HKEY rootkey;
+  HKEY rootkey = HKEY_CURRENT_USER;
   if (EQ (root, QHKCR))
     rootkey = HKEY_CLASSES_ROOT;
   else if (EQ (root, QHKCU))
@@ -10139,10 +10139,7 @@ to be converted to forward slashes by the caller.  */)
   else if (!NILP (root))
     error ("unknown root key: %s", SDATA (SYMBOL_NAME (root)));
 
-  Lisp_Object val = w32_read_registry (NILP (root)
-                                      ? HKEY_CURRENT_USER
-                                      : rootkey,
-                                      key, name);
+  Lisp_Object val = w32_read_registry (rootkey, key, name);
   if (NILP (val) && NILP (root))
     val = w32_read_registry (HKEY_LOCAL_MACHINE, key, name);