@@ -542,43 +542,6 @@ static int bus_match_add_compare_value(
542542 return r ;
543543}
544544
545- static int bus_match_find_compare_value (
546- struct bus_match_node * where ,
547- enum bus_match_node_type t ,
548- uint8_t value_u8 ,
549- const char * value_str ,
550- struct bus_match_node * * ret ) {
551-
552- struct bus_match_node * c , * n ;
553-
554- assert (where );
555- assert (IN_SET (where -> type , BUS_MATCH_ROOT , BUS_MATCH_VALUE ));
556- assert (BUS_MATCH_IS_COMPARE (t ));
557- assert (ret );
558-
559- for (c = where -> child ; c && c -> type != t ; c = c -> next )
560- ;
561-
562- if (!c )
563- return 0 ;
564-
565- if (t == BUS_MATCH_MESSAGE_TYPE )
566- n = hashmap_get (c -> compare .children , UINT_TO_PTR (value_u8 ));
567- else if (BUS_MATCH_CAN_HASH (t ))
568- n = hashmap_get (c -> compare .children , value_str );
569- else {
570- for (n = c -> child ; n && !value_node_same (n , t , value_u8 , value_str ); n = n -> next )
571- ;
572- }
573-
574- if (n ) {
575- * ret = n ;
576- return 1 ;
577- }
578-
579- return 0 ;
580- }
581-
582545static int bus_match_add_leaf (
583546 struct bus_match_node * where ,
584547 struct match_callback * callback ) {
@@ -607,34 +570,6 @@ static int bus_match_add_leaf(
607570 return 1 ;
608571}
609572
610- static int bus_match_find_leaf (
611- struct bus_match_node * where ,
612- sd_bus_message_handler_t callback ,
613- void * userdata ,
614- struct bus_match_node * * ret ) {
615-
616- struct bus_match_node * c ;
617-
618- assert (where );
619- assert (IN_SET (where -> type , BUS_MATCH_ROOT , BUS_MATCH_VALUE ));
620- assert (ret );
621-
622- for (c = where -> child ; c ; c = c -> next ) {
623- sd_bus_slot * s ;
624-
625- s = container_of (c -> leaf .callback , sd_bus_slot , match_callback );
626-
627- if (c -> type == BUS_MATCH_LEAF &&
628- c -> leaf .callback -> callback == callback &&
629- s -> userdata == userdata ) {
630- * ret = c ;
631- return 1 ;
632- }
633- }
634-
635- return 0 ;
636- }
637-
638573enum bus_match_node_type bus_match_node_type_from_string (const char * k , size_t n ) {
639574 assert (k );
640575
@@ -1014,43 +949,6 @@ int bus_match_remove(
1014949 return 1 ;
1015950}
1016951
1017- int bus_match_find (
1018- struct bus_match_node * root ,
1019- struct bus_match_component * components ,
1020- unsigned n_components ,
1021- sd_bus_message_handler_t callback ,
1022- void * userdata ,
1023- struct match_callback * * ret ) {
1024-
1025- struct bus_match_node * n , * * gc ;
1026- unsigned i ;
1027- int r ;
1028-
1029- assert (root );
1030- assert (ret );
1031-
1032- gc = newa (struct bus_match_node * , n_components );
1033-
1034- n = root ;
1035- for (i = 0 ; i < n_components ; i ++ ) {
1036- r = bus_match_find_compare_value (
1037- n , components [i ].type ,
1038- components [i ].value_u8 , components [i ].value_str ,
1039- & n );
1040- if (r <= 0 )
1041- return r ;
1042-
1043- gc [i ] = n ;
1044- }
1045-
1046- r = bus_match_find_leaf (n , callback , userdata , & n );
1047- if (r <= 0 )
1048- return r ;
1049-
1050- * ret = n -> leaf .callback ;
1051- return 1 ;
1052- }
1053-
1054952void bus_match_free (struct bus_match_node * node ) {
1055953 struct bus_match_node * c ;
1056954
0 commit comments