@@ -215,6 +215,10 @@ def regex_function_factory(func_name):
return lambda x: regex.search(x) is not None
+def regex_error_factory(description):
+ return lambda: print_error(description)
+
+
std_functions = [
('malloc', 'Use xmalloc() in place of malloc()'),
('calloc', 'Use xcalloc() in place of calloc()'),
@@ -234,8 +238,8 @@ checks += [
{'regex': '(.c|.h)(.in)?$',
'match_name': None,
'check': regex_function_factory(function_name),
- 'print': lambda: print_error(description)}
-for function_name, description in std_functions]
+ 'print': regex_error_factory(description)}
+ for (function_name, description) in std_functions]
def get_file_type_checks(filename):