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>
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;
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;
# 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,