virNetDevParseMcast: Avoid magic constant

There is no guarantee that an enum start it mapped onto a value
of zero. However, we are guaranteed that enum items are
consecutive integers. Moreover, it's a pity to define an enum to
avoid using magical constants but then using them anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-08-01 07:43:58 +02:00
parent 1f24c1494a
commit 327bc16a05

View File

@ -2708,7 +2708,7 @@ static int virNetDevParseMcast(char *buf, virNetDevMcastEntryPtr mcast)
char *saveptr; char *saveptr;
char *endptr; char *endptr;
for (ifindex = 0, next = buf; ifindex < VIR_MCAST_TYPE_LAST; ifindex++, for (ifindex = VIR_MCAST_TYPE_INDEX_TOKEN, next = buf; ifindex < VIR_MCAST_TYPE_LAST; ifindex++,
next = NULL) { next = NULL) {
token = strtok_r(next, VIR_MCAST_TOKEN_DELIMS, &saveptr); token = strtok_r(next, VIR_MCAST_TOKEN_DELIMS, &saveptr);