Don't make zero-sized allocations when cloning modifier sets
This commit is contained in:
parent
399f0b278e
commit
125e2ad5d8
|
@ -23,6 +23,9 @@ typedef enum {
|
||||||
__attribute__((unused)) inline static ModifierSet
|
__attribute__((unused)) inline static ModifierSet
|
||||||
modifier_set_copy(const ModifierSet old)
|
modifier_set_copy(const ModifierSet old)
|
||||||
{
|
{
|
||||||
|
if (!old.byte_length) {
|
||||||
|
return EMPTY_MODIFIER_SET;
|
||||||
|
};
|
||||||
ModifierSet result = old;
|
ModifierSet result = old;
|
||||||
result.bits = malloc(result.byte_length);
|
result.bits = malloc(result.byte_length);
|
||||||
if (!result.bits) {
|
if (!result.bits) {
|
||||||
|
|
Loading…
Reference in New Issue