]> xenbits.xensource.com Git - libvirt.git/commitdiff
rpc: Add typedef for the anonymous enum used for authentication methods
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Thu, 21 Dec 2017 14:28:59 +0000 (15:28 +0100)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 4 Jan 2018 11:55:31 +0000 (06:55 -0500)
Add typedef for the anonymous enum used for the authentication methods
and remove the default case. This allows the usage of the type in a
switch statement and taking advantage of the compilers feature to
detect uncovered cases.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
daemon/remote.c
src/rpc/virnetserverservice.h

index 1df02c1f50428ee2b58f8025dc871faf9c6f42c4..45cb99a56146747ebdf9fc5d5eb642d4a4cb1874 100644 (file)
@@ -3279,7 +3279,7 @@ remoteDispatchAuthList(virNetServerPtr server,
     if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0)
         goto cleanup;
 
-    switch (auth) {
+    switch ((virNetServerServiceAuthMethods) auth) {
     case VIR_NET_SERVER_SERVICE_AUTH_NONE:
         ret->types.types_val[0] = REMOTE_AUTH_NONE;
         break;
@@ -3289,8 +3289,6 @@ remoteDispatchAuthList(virNetServerPtr server,
     case VIR_NET_SERVER_SERVICE_AUTH_SASL:
         ret->types.types_val[0] = REMOTE_AUTH_SASL;
         break;
-    default:
-        ret->types.types_val[0] = REMOTE_AUTH_NONE;
     }
 
     rv = 0;
index 9afa0b13dbc6e4a90212f8a2c8718f96ef1deebd..5d8c583db2e2cd5d17992d0cf1925c1b04fa26c9 100644 (file)
 # include "virnetserverprogram.h"
 # include "virobject.h"
 
-enum {
+typedef enum {
     VIR_NET_SERVER_SERVICE_AUTH_NONE = 0,
     VIR_NET_SERVER_SERVICE_AUTH_SASL,
     VIR_NET_SERVER_SERVICE_AUTH_POLKIT,
-};
+} virNetServerServiceAuthMethods;
 
 typedef int (*virNetServerServiceDispatchFunc)(virNetServerServicePtr svc,
                                                virNetSocketPtr sock,