Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5858cf8

Browse files
committed
Fix header comment for bitncmp().
The result is an int less than, equal to, or greater than zero, in thestyle of memcmp (and, in fact, exactly the output of memcmp in some cases).This comment previously said -1, 1, or 0, which was an overspecification,as noted by Emre Hasegeli. All of the existing callers appear to be finewith the actual behavior, so just fix the comment.In passing, improve infelicitous formatting of some call sites.
1 parent9929975 commit5858cf8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/utils/adt/network.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,8 @@ network_sub(PG_FUNCTION_ARGS)
544544

545545
if (ip_family(a1)==ip_family(a2))
546546
{
547-
PG_RETURN_BOOL(ip_bits(a1)>ip_bits(a2)
548-
&&bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a2))==0);
547+
PG_RETURN_BOOL(ip_bits(a1)>ip_bits(a2)&&
548+
bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a2))==0);
549549
}
550550

551551
PG_RETURN_BOOL(false);
@@ -559,8 +559,8 @@ network_subeq(PG_FUNCTION_ARGS)
559559

560560
if (ip_family(a1)==ip_family(a2))
561561
{
562-
PG_RETURN_BOOL(ip_bits(a1) >=ip_bits(a2)
563-
&&bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a2))==0);
562+
PG_RETURN_BOOL(ip_bits(a1) >=ip_bits(a2)&&
563+
bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a2))==0);
564564
}
565565

566566
PG_RETURN_BOOL(false);
@@ -574,8 +574,8 @@ network_sup(PG_FUNCTION_ARGS)
574574

575575
if (ip_family(a1)==ip_family(a2))
576576
{
577-
PG_RETURN_BOOL(ip_bits(a1)<ip_bits(a2)
578-
&&bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a1))==0);
577+
PG_RETURN_BOOL(ip_bits(a1)<ip_bits(a2)&&
578+
bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a1))==0);
579579
}
580580

581581
PG_RETURN_BOOL(false);
@@ -589,8 +589,8 @@ network_supeq(PG_FUNCTION_ARGS)
589589

590590
if (ip_family(a1)==ip_family(a2))
591591
{
592-
PG_RETURN_BOOL(ip_bits(a1) <=ip_bits(a2)
593-
&&bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a1))==0);
592+
PG_RETURN_BOOL(ip_bits(a1) <=ip_bits(a2)&&
593+
bitncmp(ip_addr(a1),ip_addr(a2),ip_bits(a1))==0);
594594
}
595595

596596
PG_RETURN_BOOL(false);
@@ -955,7 +955,7 @@ convert_network_to_scalar(Datum value, Oid typid)
955955
* bitncmp(l, r, n)
956956
*compare bit masks l and r, for n bits.
957957
* return:
958-
*-1, 1, or 0 in the libc tradition.
958+
*<0, >0, or 0 in the libc tradition.
959959
* note:
960960
*network byte order assumed. this means 192.5.5.240/28 has
961961
*0x11110000 in its fourth octet.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp