edenhill / librd

Rapid Development C utility library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LIST_MOVE collision with alpine linux bsd headers

eugpermar opened this issue · comments

I'm trying to use librd in alpine linux. However, it bsd-tools package already have a LIST_MOVE macro define in it's package bsd-compat-headers.

It could be fixed easily with an ifdef, but alpine LIST_MOVE has a different (simpler) macro arguments:

#define LIST_MOVE(head1, head2) do {                                    \ 
        LIST_INIT((head2));                                             \ 
        if (!LIST_EMPTY((head1))) {                                     \  
                (head2)->lh_first = (head1)->lh_first;                  \
                LIST_INIT((head1));                                     \
        }                                                               \ 
} while (/*CONSTCOND*/0)    

So the solutions could be:

  1. (I think that) no one has tried this before, so librd could just override LIST_MOVE. Future projects that include librd and uses alpine-like LIST_MOVE will break
  2. Move to alpine-like definition, so anyone that uses librd LIST_MOVE break.

I personally prefer option 2, but probably you will like to maintain retro-compatibility. It you choose the option, I can send you the PR.

I vote for option 2 (which is what librdkafka has already done).

Done then. Thanks!