dummy/dummy.c: Fix unaligned access in dummy_get_level()

This fixes an unaligned access in dummy/dummy.c in the function
dummy_get_level() which resulted in crashes (Bus Error) on systems
with stricter alignment requirements such as SPARC.

On x86_64 (and any other architecture with less strict alignment
requirements), the compiler automatically optimizes the memcpy()
out if necessary such that there are no performance issues.
pull/497/head
John Paul Adrian Glaubitz 2020-02-08 10:21:08 -08:00 zatwierdzone przez Christoph Berg
rodzic cf858bfa3c
commit 5805de6e1e
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1123,7 +1123,7 @@ static int dummy_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
break;
}
*val = curr->levels[idx];
memcpy (val, &curr->levels[idx], sizeof(value_t));
rig_debug(RIG_DEBUG_VERBOSE, "%s called: %s\n", __func__,
rig_strlevel(level));