shdown / luastatus

universal status bar content generator
GNU General Public License v3.0
295 stars 12 forks source link

network.c: fixed building on musl #73

Closed u1adzik closed 1 month ago

u1adzik commented 1 month ago

there was an error while building plugins/network.c on musl (alpine linux)

shdown commented 1 month ago

That’s a good one, but:

  1. Why did you remove the comment on why we allocate the buffer on the heap?
  2. You should probably have included some information to the commit message as to why the old version failed to build. It’s because they’re inserting paddings: https://git.musl-libc.org/cgit/musl/commit/?id=7168790763cdeb794df52be6e3b3
u1adzik commented 1 month ago
  1. Why did you remove the comment on why we allocate the buffer on the heap?

Oh, I'm sorry, I didn't notice that. I will make a new PR soon with the comments left

shdown commented 1 month ago

You can also change the line above the one you changed, because POSIX does not guarantee the absence of other members (or even the ordering of the members) for struct iovec either:

struct iovec iov = {buf, NBUF};

I didn’t find any other instances of initializing an externally-defined struct with non-designated initializers (othan than {0}, which is OK).