Allow all set entry types to be implicitly cast to their key/value type to allow for easier iteration

This commit is contained in:
gingerBill
2023-01-03 12:18:35 +00:00
parent 252be0fb41
commit 747a11a954
8 changed files with 50 additions and 50 deletions
+2 -4
View File
@@ -1332,11 +1332,10 @@ gb_internal void enable_target_feature(TokenPos pos, String const &target_featur
gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bool with_quotes) {
isize len = 0;
isize i = 0;
for (auto const &entry : build_context.target_features_set) {
for (String const &feature : build_context.target_features_set) {
if (i != 0) {
len += 1;
}
String feature = entry.value;
len += feature.len;
if (with_quotes) len += 2;
i += 1;
@@ -1344,13 +1343,12 @@ gb_internal char const *target_features_set_to_cstring(gbAllocator allocator, bo
char *features = gb_alloc_array(allocator, char, len+1);
len = 0;
i = 0;
for (auto const &entry : build_context.target_features_set) {
for (String const &feature : build_context.target_features_set) {
if (i != 0) {
features[len++] = ',';
}
if (with_quotes) features[len++] = '"';
String feature = entry.value;
gb_memmove(features + len, feature.text, feature.len);
len += feature.len;
if (with_quotes) features[len++] = '"';