@@ -460,7 +460,7 @@ fn evaluate_c_defines_line(line: &str) -> bool {
460460
461461fn make_move_take_signatures ( path_in : & str ) -> ( Vec < FunctionSignature > , Vec < FunctionSignature > ) {
462462 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
463- let re = Regex :: new ( r"(\w+)_drop\(struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
463+ let re = Regex :: new ( r"(\w+)_drop\((?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
464464 let mut move_funcs = Vec :: < FunctionSignature > :: new ( ) ;
465465 let mut take_funcs = Vec :: < FunctionSignature > :: new ( ) ;
466466
@@ -493,7 +493,7 @@ fn make_move_take_signatures(path_in: &str) -> (Vec<FunctionSignature>, Vec<Func
493493
494494fn find_loan_functions ( path_in : & str ) -> Vec < FunctionSignature > {
495495 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
496- let re = Regex :: new ( r"const struct (\w+) \*(\w+)_loan\(const struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
496+ let re = Regex :: new ( r"const (?: struct\s+)? (\w+) \*(\w+)_loan\(const (?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
497497 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
498498
499499 for ( _, [ return_type, func_name, arg_type, arg_name] ) in
@@ -516,7 +516,7 @@ fn find_loan_functions(path_in: &str) -> Vec<FunctionSignature> {
516516
517517fn find_loan_mut_functions ( path_in : & str ) -> Vec < FunctionSignature > {
518518 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
519- let re = Regex :: new ( r"struct (\w+) \*(\w+)_loan_mut\(struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
519+ let re = Regex :: new ( r"(?: struct\s+)? (\w+) \*(\w+)_loan_mut\((?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
520520 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
521521
522522 for ( _, [ return_type, func_name, arg_type, arg_name] ) in
@@ -536,7 +536,7 @@ fn find_loan_mut_functions(path_in: &str) -> Vec<FunctionSignature> {
536536
537537fn find_take_from_loaned_functions ( path_in : & str ) -> Vec < FunctionSignature > {
538538 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
539- let re = Regex :: new ( r"void (\w+)_take_from_loaned\(struct (\w+) \*(\w+)" ) . unwrap ( ) ;
539+ let re = Regex :: new ( r"void (\w+)_take_from_loaned\((?: struct\s+)? (\w+) \*(\w+)" ) . unwrap ( ) ;
540540 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
541541
542542 for ( _, [ func_name, arg_type, arg_name] ) in re. captures_iter ( & bindings) . map ( |c| c. extract ( ) ) {
@@ -559,7 +559,7 @@ fn find_take_from_loaned_functions(path_in: &str) -> Vec<FunctionSignature> {
559559
560560fn find_drop_functions ( path_in : & str ) -> Vec < FunctionSignature > {
561561 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
562- let re = Regex :: new ( r"(.+?) +(\w+_drop)\(struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
562+ let re = Regex :: new ( r"(.+?) +(\w+_drop)\((?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
563563 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
564564
565565 for ( _, [ return_type, func_name, arg_type, arg_name] ) in
@@ -586,7 +586,7 @@ fn find_drop_functions(path_in: &str) -> Vec<FunctionSignature> {
586586
587587fn find_null_functions ( path_in : & str ) -> Vec < FunctionSignature > {
588588 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
589- let re = Regex :: new ( r" (z.?_internal_\w+_null)\(struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
589+ let re = Regex :: new ( r" (z.?_internal_\w+_null)\((?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
590590 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
591591
592592 for ( _, [ func_name, arg_type, arg_name] ) in re. captures_iter ( & bindings) . map ( |c| c. extract ( ) ) {
@@ -604,7 +604,7 @@ fn find_null_functions(path_in: &str) -> Vec<FunctionSignature> {
604604
605605fn find_check_functions ( path_in : & str ) -> Vec < FunctionSignature > {
606606 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
607- let re = Regex :: new ( r"bool (z.?_internal_\w+_check)\(const struct (\w+) \*(\w+)\);" ) . unwrap ( ) ;
607+ let re = Regex :: new ( r"bool (z.?_internal_\w+_check)\(const (?: struct\s+)? (\w+) \*(\w+)\);" ) . unwrap ( ) ;
608608 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
609609
610610 for ( _, [ func_name, arg_type, arg_name] ) in re. captures_iter ( & bindings) . map ( |c| c. extract ( ) ) {
@@ -626,7 +626,7 @@ fn find_check_functions(path_in: &str) -> Vec<FunctionSignature> {
626626fn find_call_functions ( path_in : & str ) -> Vec < FunctionSignature > {
627627 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
628628 let re = Regex :: new (
629- r"(\w+) (\w+)_call\(const struct (\w+) \*(\w+),\s+(\w*)\s*struct (\w+) (\*?)(\w+)\);" ,
629+ r"(\w+) (\w+)_call\(const (?: struct\s+)? (\w+) \*(\w+),\s+(\w*)\s*(?: struct\s+)? (\w+) (\*?)(\w+)\);" ,
630630 )
631631 . unwrap ( ) ;
632632 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
@@ -659,7 +659,7 @@ fn find_call_functions(path_in: &str) -> Vec<FunctionSignature> {
659659fn find_closure_constructors ( path_in : & str ) -> Vec < FunctionSignature > {
660660 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
661661 let re = Regex :: new (
662- r"(\w+) (\w+)_closure_(\w+)\(struct\s+(\w+)\s+\*(\w+),\s+void\s+\(\*call\)(\([\s\w,\*]*\)),\s+void\s+\(\*drop\)(\(.*\)),\s+void\s+\*context\);"
662+ r"(\w+) (\w+)_closure_(\w+)\((?: struct\s+)? (\w+)\s+\*(\w+),\s+void\s+\(\*call\)(\([\s\w,\*]*\)),\s+void\s+\(\*drop\)(\(.*\)),\s+void\s+\*context\);"
663663 )
664664 . unwrap ( ) ;
665665 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
@@ -694,7 +694,7 @@ fn find_closure_constructors(path_in: &str) -> Vec<FunctionSignature> {
694694
695695fn find_recv_functions ( path_in : & str ) -> Vec < FunctionSignature > {
696696 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
697- let re = Regex :: new ( r"(\w+)\s+z_(\w+)_handler_(\w+)_recv\(const\s+struct\s+(\w+)\s+\*(\w+),\s+struct\s+(\w+)\s+\*(\w+)\);" ) . unwrap ( ) ;
697+ let re = Regex :: new ( r"(\w+)\s+z_(\w+)_handler_(\w+)_recv\(const\s+(?: struct\s+)? (\w+)\s+\*(\w+),\s+(?: struct\s+)? (\w+)\s+\*(\w+)\);" ) . unwrap ( ) ;
698698 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
699699
700700 for ( _, [ return_type, handler_type, value_type, arg1_type, arg1_name, arg2_type, arg2_name] ) in
@@ -718,7 +718,7 @@ fn find_recv_functions(path_in: &str) -> Vec<FunctionSignature> {
718718fn find_clone_functions ( path_in : & str ) -> Vec < FunctionSignature > {
719719 let bindings = std:: fs:: read_to_string ( path_in) . unwrap ( ) ;
720720 let re = Regex :: new (
721- r"(\w+)\s+z_(\w+)_clone\(struct\s+(\w+)\s+\*(\w+),\s+const\s+struct\s+(\w+)\s+\*(\w+)\);" ,
721+ r"(\w+)\s+z_(\w+)_clone\((?: struct\s+)? (\w+)\s+\*(\w+),\s+const\s+(?: struct\s+)? (\w+)\s+\*(\w+)\);" ,
722722 )
723723 . unwrap ( ) ;
724724 let mut res = Vec :: < FunctionSignature > :: new ( ) ;
0 commit comments