Skip to content

Commit

Permalink
Move directives outside rb_ary_new3 call
Browse files Browse the repository at this point in the history
This function may be a macro for optimization, which will be expanded
to `rb_ary_new_from_values`.

```
ext/socket/ancdata.c: In function ‘bsock_recvmsg_internal’:
ext/socket/ancdata.c:1648:1: error: embedding a directive within macro arguments is not portable
 1648 | #if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
      | ^
ext/socket/ancdata.c:1650:1: error: embedding a directive within macro arguments is not portable
 1650 | #else
      | ^
ext/socket/ancdata.c:1652:1: error: embedding a directive within macro arguments is not portable
 1652 | #endif
      | ^
```
  • Loading branch information
nobu committed Oct 10, 2024
1 parent 6f67358 commit 51fdd2c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ext/socket/ancdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1643,14 +1643,14 @@ bsock_recvmsg_internal(VALUE sock,
rb_obj_reveal(dat_str, rb_cString);
}

ret = rb_ary_new3(3, dat_str,
rsock_io_socket_addrinfo(sock, mh.msg_name, mh.msg_namelen),
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
INT2NUM(mh.msg_flags)
VALUE msg_flags = INT2NUM(mh.msg_flags);
#else
Qnil
VALUE msg_flags = Qnil;
#endif
);
ret = rb_ary_new3(3, dat_str,
rsock_io_socket_addrinfo(sock, mh.msg_name, mh.msg_namelen),
msg_flags);

#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr);
Expand Down

0 comments on commit 51fdd2c

Please sign in to comment.