Skip to content

Commit b1febd0

Browse files
committed
Make prev/next work on OTP < 27.*
1 parent e389750 commit b1febd0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tr.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ next(#tr{index = Index}, Options) ->
583583

584584
-spec next(index(), pred(tr()), table()) -> tr().
585585
next(Index, Pred, Tab) ->
586-
case ets:next_lookup(Tab, Index) of
587-
{NextIndex, [NextT]} ->
586+
case ets:lookup(Tab, ets:next(Tab, Index)) of
587+
[NextT = #tr{index = NextIndex}] ->
588588
case catch Pred(NextT) of
589589
true -> NextT;
590590
_ -> next(NextIndex, Pred, Tab)
@@ -619,8 +619,8 @@ prev(#tr{index = Index}, Options) ->
619619

620620
-spec prev(index(), pred(tr()), table()) -> tr().
621621
prev(Index, Pred, Tab) ->
622-
case ets:prev_lookup(Tab, Index) of
623-
{PrevIndex, [PrevT]} ->
622+
case ets:lookup(Tab, ets:prev(Tab, Index)) of
623+
[PrevT = #tr{index = PrevIndex}] ->
624624
case catch Pred(PrevT) of
625625
true -> PrevT;
626626
_ -> prev(PrevIndex, Pred, Tab)

0 commit comments

Comments
 (0)