- dst->Booleans = typeMalloc(NCURSES_SBOOL, NUM_BOOLEANS(dst));
- dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst));
- dst->Strings = typeMalloc(char *, NUM_STRINGS(dst));
-
- /* FIXME: use memcpy for these and similar loops */
- for_each_boolean(i, dst)
- dst->Booleans[i] = src->Booleans[i];
- for_each_number(i, dst)
- dst->Numbers[i] = src->Numbers[i];
- for_each_string(i, dst)
- dst->Strings[i] = src->Strings[i];
+
+ TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans);
+ TYPE_MALLOC(short, NUM_NUMBERS(dst), dst->Numbers);
+ TYPE_MALLOC(char *, NUM_STRINGS(dst), dst->Strings);
+
+ memcpy(dst->Booleans,
+ src->Booleans,
+ NUM_BOOLEANS(dst) * sizeof(dst->Booleans[0]));
+ memcpy(dst->Numbers,
+ src->Numbers,
+ NUM_NUMBERS(dst) * sizeof(dst->Numbers[0]));
+ memcpy(dst->Strings,
+ src->Strings,
+ NUM_STRINGS(dst) * sizeof(dst->Strings[0]));