- char *report;
-
- report = report_on_lines(&m->c_files, report_on_trailing_whitespace,
- NULL);
- report = report_on_lines(&m->h_files, report_on_trailing_whitespace,
- report);
-
- return report;
-}
-
-static const char *describe_trailing_whitespace(struct manifest *m,
- void *check_result)
-{
- return talloc_asprintf(check_result,
- "Some source files have trailing whitespace:\n"
- "%s", (char *)check_result);
+ struct list_head *list;
+ struct ccan_file *f;
+ unsigned int i;
+
+ foreach_ptr(list, &m->c_files, &m->h_files) {
+ list_for_each(list, f, list) {
+ char **lines = get_ccan_file_lines(f);
+ for (i = 0; i < f->num_lines; i++) {
+ char *err = get_trailing_whitespace(lines[i]);
+ if (err) {
+ score->error = "Trailing whitespace"
+ " found";
+ score_file_error(score, f, i+1, err);
+ }
+ }
+ }
+ }
+ if (!score->error) {
+ score->pass = true;
+ score->score = score->total;
+ }