scripts/wrap/cpp.py: also use pdf_new_foo_*() fns as constructors of fz_* structs.
authorJulian Smith <[email protected]>
Thu, 23 Mar 2023 15:57:14 +0000 (15:57 +0000)
committerJulian Smith <[email protected]>
Fri, 24 Mar 2023 14:10:45 +0000 (14:10 +0000)
We previously only considered fz_new_() fns as constructors of fz_* structs,
but the fz_/pdf_ prefix is determined by the args, not the return type, so this
was missing possible constructors.

E.g. this picks up pdf_new_stext_page_from_annot() as a constructor of
fz_stext_page.

scripts/wrap/cpp.py

index 291038ffb47849cdc1b9c61819e596636f075fe4..c86990dd7f8b811f31d45b2bbb8962761f7b6045 100644 (file)
@@ -1726,6 +1726,7 @@ def class_find_constructor_fns( tu, classname, struct_name, base_name, extras):
         # Add default constructor fn prefix.
         if struct_name.startswith( 'fz_'):
             extras.constructor_prefixes.insert( 0, f'fz_new_')
+            extras.constructor_prefixes.insert( 0, f'pdf_new_')
         elif struct_name.startswith( 'pdf_'):
             extras.constructor_prefixes.insert( 0, f'pdf_new_')
     for fnprefix in extras.constructor_prefixes: