This commit is contained in:
anlicheng 2025-04-29 00:57:06 +08:00
parent 4489bdd79c
commit fc338360b9

View File

@ -145,15 +145,17 @@ match_topic(Topic0, Topic1) ->
%% *++ %% *++
-spec match_components(list(), list()) -> boolean(). -spec match_components(list(), list()) -> boolean().
match_components([<<$+>>], [_|_]) -> match_components(A, B) when is_list(A), is_list(B) ->
match_components(A, B, false).
match_components([<<"+">>], [_|_], _) ->
true; true;
match_components([], []) -> match_components([], [], _) ->
true; true;
match_components([<<$*>>|T0], [_|T1]) -> match_components([<<"*">>|T0], [_|T1], _) ->
match_components(T0, T1); match_components(T0, T1, false);
match_components([C0|T0], [C0|T1]) -> match_components([C0|T0], [C0|T1], _) ->
match_components(T0, T1); match_components(T0, T1, false);
match_components(_, _) -> match_components(_, _, _) ->
false. false.
-spec of_components(Topic :: binary()) -> [binary()]. -spec of_components(Topic :: binary()) -> [binary()].