Skip to content

Instantly share code, notes, and snippets.

@moonpolysoft
Created March 8, 2009 03:16
Show Gist options
  • Save moonpolysoft/75554 to your computer and use it in GitHub Desktop.
Save moonpolysoft/75554 to your computer and use it in GitHub Desktop.
%% this is necessary because the binlists returned from the port driver driver_outputv
%% come back as a list with a binary as the last element, not a null list. In other words
%% [a|b] rather than [a|[b|[]]]. Thus breaking *everything* that expects a well formed list.
normalize_tarded_binlist(List) ->
normalize_tarded_binlist(List, []).
normalize_tarded_binlist(Bin, Acc) when not is_list(Bin) ->
lists:reverse([Bin|Acc]);
normalize_tarded_binlist([Bin|Rest], Acc) ->
normalize_tarded_binlist(Rest, [Bin|Acc]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment