X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fvalidate.c;h=2dfc3d46103b7d4a96be8069f19cdcf467670f3e;hp=c2575e59cb421fbd129a54c91e15f86d85039c64;hb=fecb0372ee8e219a7ebd51406dee3e1008ccb7ec;hpb=c9384515a81cb64d345b299908b2852f51bb8e6e diff --git a/src/validate.c b/src/validate.c index c2575e5..2dfc3d4 100644 --- a/src/validate.c +++ b/src/validate.c @@ -170,8 +170,8 @@ bool psi_validate(struct psi_validate_scope *scope, unsigned flags = dst->flags; size_t check_count = ~0; - /* fail early if library is not found */ - if (!psi_decl_file_validate(dst, src, &scope->dlopened)) { + /* fail early if libraries are not found */ + if (!psi_decl_file_validate(dst, src)) { return false; } @@ -203,17 +203,20 @@ bool psi_validate(struct psi_validate_scope *scope, } /* nothing changed; bail out */ - if (count_all && (dst->flags & PSI_SILENT) && !(flags & PSI_SILENT)) { - /* one last error-spitting round, if not explicitly suppressed */ - dst->flags ^= PSI_SILENT; - check_count = ~0; + if (count_all) { + src->errors += count_all; - PSI_DEBUG_PRINT(dst, "PSI: validation bail out with %zu" - " type checks remaining, errors follow\n", count_all); - continue; + if ((dst->flags & PSI_SILENT) && !(flags & PSI_SILENT)) { + /* one last error-spitting round, if not explicitly suppressed */ + dst->flags ^= PSI_SILENT; + check_count = ~0; + + PSI_DEBUG_PRINT(dst, "PSI: validation bail out with %zu" + " type checks remaining, errors follow\n", count_all); + continue; + } } - src->errors += count_all; break; } @@ -223,5 +226,30 @@ bool psi_validate(struct psi_validate_scope *scope, psi_validate_list(scope, dst, &consts, psi_validate_const); psi_validate_list(scope, dst, &impls, psi_validate_impl); + if (types.cur != types.src) { + psi_plist_free(types.cur); + } + if (structs.cur != structs.src) { + psi_plist_free(structs.cur); + } + if (unions.cur != unions.src) { + psi_plist_free(unions.cur); + } + if (enums.cur != enums.src) { + psi_plist_free(enums.cur); + } + if (vars.cur != vars.src) { + psi_plist_free(vars.cur); + } + if (decls.cur != decls.src) { + psi_plist_free(decls.cur); + } + if (consts.cur != consts.src) { + psi_plist_free(consts.cur); + } + if (impls.cur != impls.src) { + psi_plist_free(impls.cur); + } + return true; }