Skip to content

Commit 605a32c

Browse files
robUx4chouquette
authored andcommitted
mdns: use alloca to make MSVC happy
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
1 parent d7077ff commit 605a32c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mdns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ mdns_listen(const struct mdns_ctx *ctx, const char *const names[],
541541
for (t1 = t2 = time(NULL); stop(p_cookie) == false; t2 = time(NULL)) {
542542
struct mdns_hdr ahdr = {0};
543543
struct rr_entry *entries;
544-
struct pollfd pfd[ctx->nb_conns];
544+
struct pollfd *pfd = alloca( sizeof(*pfd) * ctx->nb_conns );
545545

546546
for (size_t i = 0; i < ctx->nb_conns; ++i) {
547547
pfd[i].fd = ctx->conns[i].sock;
@@ -623,7 +623,7 @@ mdns_serve(struct mdns_ctx *ctx, mdns_stop_func stop, void *p_cookie)
623623
}
624624

625625
for (; stop(p_cookie) == false;) {
626-
struct pollfd pfd[ctx->nb_conns];
626+
struct pollfd *pfd = alloca( sizeof(*pfd) * ctx->nb_conns );
627627

628628
for (size_t i = 0; i < ctx->nb_conns; ++i) {
629629
pfd[i].fd = ctx->conns[i].sock;

0 commit comments

Comments
 (0)