From 799503f4bb8318733aeaf2e707ad4df8e8e0da96 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Fri, 12 Jul 2024 19:19:37 +0200 Subject: [PATCH] avfilter/vf_coreimage: simplify list_filters code Use fast-enumeration and get rid of unnecessary intermediate variables. --- libavfilter/vf_coreimage.m | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m index b4a4d6c476..a342f83475 100644 --- a/libavfilter/vf_coreimage.m +++ b/libavfilter/vf_coreimage.m @@ -102,19 +102,13 @@ static void list_filters(CoreImageContext *ctx) filter_categories = [NSArray arrayWithObjects:kCICategoryGenerator, nil]; } - NSArray *filter_names = [CIFilter filterNamesInCategories:filter_categories]; - NSEnumerator *filters = [filter_names objectEnumerator]; + for (NSString *filter_name in [CIFilter filterNamesInCategories:filter_categories]) { + CIFilter *filter = [CIFilter filterWithName:filter_name]; + NSDictionary *filter_attribs = [filter attributes]; - NSString *filter_name; - while (filter_name = [filters nextObject]) { av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]); - NSString *input; - CIFilter *filter = [CIFilter filterWithName:filter_name]; - NSDictionary *filter_attribs = [filter attributes]; // - NSArray *filter_inputs = [filter inputKeys]; // - - for (input in filter_inputs) { + for (NSString *input in [filter inputKeys]) { NSDictionary *input_attribs = [filter_attribs valueForKey:input]; NSString *input_class = [input_attribs valueForKey:kCIAttributeClass]; if ([input_class isEqualToString:@"NSNumber"]) {