prefer std.meta.fieldNames for creating the array

This commit is contained in:
Halil Durak
2025-11-13 15:38:48 +03:00
parent c459325a5f
commit 73574dce52

View File

@@ -112,16 +112,6 @@ pub const Extension = union(enum) {
};
};
/// An array of supported WebGL extensions.
const extension_array = blk: {
const fields = @typeInfo(Extension.Kind).@"enum".fields;
var items: [fields.len][:0]const u8 = undefined;
for (fields, 0..) |field, i| {
items[i] = field.name;
}
break :blk items;
};
/// Enables a WebGL extension.
pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Extension {
_ = self;
@@ -136,5 +126,5 @@ pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Exte
/// Returns a list of all the supported WebGL extensions.
pub fn _getSupportedExtensions(_: *const WebGLRenderingContext) []const []const u8 {
return &extension_array;
return std.meta.fieldNames(Extension.Kind);
}