Skip to content

Commit e347894

Browse files
nikicSjonHortensius
authored andcommitted
Fix bug #79924
Move functions that are only used with ipv6 support under HAVE_IPV6 checks.
1 parent 73be708 commit e347894

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

ext/sockets/conversions.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -499,34 +499,36 @@ void to_zval_read_int(const char *data, zval *zv, res_context *ctx)
499499

500500
ZVAL_LONG(zv, (zend_long)ival);
501501
}
502-
static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx)
502+
static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx)
503503
{
504-
unsigned ival;
504+
uint16_t ival;
505505
memcpy(&ival, data, sizeof(ival));
506506

507-
ZVAL_LONG(zv, (zend_long)ival);
507+
ZVAL_LONG(zv, (zend_long)ntohs(ival));
508508
}
509-
static void to_zval_read_net_uint16(const char *data, zval *zv, res_context *ctx)
509+
static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx)
510510
{
511-
uint16_t ival;
511+
sa_family_t ival;
512512
memcpy(&ival, data, sizeof(ival));
513513

514-
ZVAL_LONG(zv, (zend_long)ntohs(ival));
514+
ZVAL_LONG(zv, (zend_long)ival);
515515
}
516-
static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx)
516+
#if HAVE_IPV6
517+
static void to_zval_read_unsigned(const char *data, zval *zv, res_context *ctx)
517518
{
518-
uint32_t ival;
519+
unsigned ival;
519520
memcpy(&ival, data, sizeof(ival));
520521

521522
ZVAL_LONG(zv, (zend_long)ival);
522523
}
523-
static void to_zval_read_sa_family(const char *data, zval *zv, res_context *ctx)
524+
static void to_zval_read_uint32(const char *data, zval *zv, res_context *ctx)
524525
{
525-
sa_family_t ival;
526+
uint32_t ival;
526527
memcpy(&ival, data, sizeof(ival));
527528

528529
ZVAL_LONG(zv, (zend_long)ival);
529530
}
531+
#endif
530532
#ifdef SO_PASSCRED
531533
static void to_zval_read_pid_t(const char *data, zval *zv, res_context *ctx)
532534
{
@@ -1232,6 +1234,7 @@ void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx)
12321234
to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx);
12331235
}
12341236

1237+
#if defined(IPV6_PKTINFO) && HAVE_IPV6
12351238
/* CONVERSIONS for if_index */
12361239
static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx)
12371240
{
@@ -1288,7 +1291,6 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context
12881291
}
12891292

12901293
/* CONVERSIONS for struct in6_pktinfo */
1291-
#if defined(IPV6_PKTINFO) && HAVE_IPV6
12921294
static const field_descriptor descriptors_in6_pktinfo[] = {
12931295
{"addr", sizeof("addr"), 1, offsetof(struct in6_pktinfo, ipi6_addr), from_zval_write_sin6_addr, to_zval_read_sin6_addr},
12941296
{"ifindex", sizeof("ifindex"), 1, offsetof(struct in6_pktinfo, ipi6_ifindex), from_zval_write_ifindex, to_zval_read_unsigned},

0 commit comments

Comments
 (0)