Move directives outside rb_ary_new3 call

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
      | ^
```
This commit is contained in:
Nobuyoshi Nakada 2024-10-10 11:30:37 +09:00
parent 6f6735898a
commit 51fdd2c6ca
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -1643,14 +1643,14 @@ bsock_recvmsg_internal(VALUE sock,
rb_obj_reveal(dat_str, rb_cString);
}
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
VALUE msg_flags = INT2NUM(mh.msg_flags);
#else
VALUE msg_flags = Qnil;
#endif
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)
#else
Qnil
#endif
);
msg_flags);
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr);