aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/network.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2011-04-10 11:42:00 -0400
committerBruce Momjian <bruce@momjian.us>2011-04-10 11:42:00 -0400
commitbf50caf105a901c4f83ac1df3cdaf910c26694a4 (patch)
treedac42d7795070f107eefb085c500f86a4d35f92f /src/backend/utils/adt/network.c
parent9a8b73147c07e02e10e0d0a34aa99d72e3336fb2 (diff)
downloadpostgresql-bf50caf105a901c4f83ac1df3cdaf910c26694a4.tar.gz
postgresql-bf50caf105a901c4f83ac1df3cdaf910c26694a4.zip
pgindent run before PG 9.1 beta 1.
Diffstat (limited to 'src/backend/utils/adt/network.c')
-rw-r--r--src/backend/utils/adt/network.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index 8cac11134c4..80e5915b3e5 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -319,7 +319,7 @@ inet_to_cidr(PG_FUNCTION_ARGS)
inet *src = PG_GETARG_INET_P(0);
inet *dst;
int bits;
- int byte;
+ int byte;
int nbits;
int maxbytes;
@@ -340,15 +340,15 @@ inet_to_cidr(PG_FUNCTION_ARGS)
/* clear the first byte, this might be a partial byte */
if (nbits != 0)
{
- ip_addr(dst)[byte] &=~(0xFF >> nbits);
- byte ++;
+ ip_addr(dst)[byte] &= ~(0xFF >> nbits);
+ byte++;
}
/* clear remaining bytes */
maxbytes = ip_addrsize(dst);
- while (byte <maxbytes)
+ while (byte < maxbytes)
{
ip_addr(dst)[byte] = 0;
- byte ++;
+ byte++;
}
PG_RETURN_INET_P(dst);
@@ -384,7 +384,7 @@ cidr_set_masklen(PG_FUNCTION_ARGS)
inet *src = PG_GETARG_INET_P(0);
int bits = PG_GETARG_INT32(1);
inet *dst;
- int byte;
+ int byte;
int nbits;
int maxbytes;
@@ -409,15 +409,15 @@ cidr_set_masklen(PG_FUNCTION_ARGS)
/* clear the first byte, this might be a partial byte */
if (nbits != 0)
{
- ip_addr(dst)[byte] &=~(0xFF >> nbits);
- byte ++;
+ ip_addr(dst)[byte] &= ~(0xFF >> nbits);
+ byte++;
}
/* clear remaining bytes */
maxbytes = ip_addrsize(dst);
- while (byte <maxbytes)
+ while (byte < maxbytes)
{
ip_addr(dst)[byte] = 0;
- byte ++;
+ byte++;
}
PG_RETURN_INET_P(dst);
@@ -716,7 +716,7 @@ network_broadcast(PG_FUNCTION_ARGS)
{
inet *ip = PG_GETARG_INET_P(0);
inet *dst;
- int byte;
+ int byte;
int bits;
int maxbytes;
unsigned char mask;
@@ -735,7 +735,7 @@ network_broadcast(PG_FUNCTION_ARGS)
a = ip_addr(ip);
b = ip_addr(dst);
- for (byte = 0; byte <maxbytes; byte ++)
+ for (byte = 0; byte < maxbytes; byte++)
{
if (bits >= 8)
{
@@ -750,7 +750,7 @@ network_broadcast(PG_FUNCTION_ARGS)
bits = 0;
}
- b[byte] = a[byte] |mask;
+ b[byte] = a[byte] | mask;
}
ip_family(dst) = ip_family(ip);
@@ -765,7 +765,7 @@ network_network(PG_FUNCTION_ARGS)
{
inet *ip = PG_GETARG_INET_P(0);
inet *dst;
- int byte;
+ int byte;
int bits;
unsigned char mask;
unsigned char *a,
@@ -793,8 +793,8 @@ network_network(PG_FUNCTION_ARGS)
bits = 0;
}
- b[byte] = a[byte] &mask;
- byte ++;
+ b[byte] = a[byte] & mask;
+ byte++;
}
ip_family(dst) = ip_family(ip);
@@ -809,7 +809,7 @@ network_netmask(PG_FUNCTION_ARGS)
{
inet *ip = PG_GETARG_INET_P(0);
inet *dst;
- int byte;
+ int byte;
int bits;
unsigned char mask;
unsigned char *b;
@@ -836,7 +836,7 @@ network_netmask(PG_FUNCTION_ARGS)
}
b[byte] = mask;
- byte ++;
+ byte++;
}
ip_family(dst) = ip_family(ip);
@@ -851,7 +851,7 @@ network_hostmask(PG_FUNCTION_ARGS)
{
inet *ip = PG_GETARG_INET_P(0);
inet *dst;
- int byte;
+ int byte;
int bits;
int maxbytes;
unsigned char mask;
@@ -884,7 +884,7 @@ network_hostmask(PG_FUNCTION_ARGS)
}
b[byte] = mask;
- byte --;
+ byte--;
}
ip_family(dst) = ip_family(ip);
@@ -994,7 +994,7 @@ bitncmp(void *l, void *r, int n)
static bool
addressOK(unsigned char *a, int bits, int family)
{
- int byte;
+ int byte;
int nbits;
int maxbits;
int maxbytes;
@@ -1022,12 +1022,12 @@ addressOK(unsigned char *a, int bits, int family)
if (bits != 0)
mask >>= nbits;
- while (byte <maxbytes)
+ while (byte < maxbytes)
{
- if ((a[byte] &mask) != 0)
+ if ((a[byte] & mask) != 0)
return false;
mask = 0xff;
- byte ++;
+ byte++;
}
return true;
@@ -1396,7 +1396,7 @@ inetmi(PG_FUNCTION_ARGS)
* two's complement, too bad.
*/
int nb = ip_addrsize(ip);
- int byte = 0;
+ int byte = 0;
unsigned char *pip = ip_addr(ip);
unsigned char *pip2 = ip_addr(ip2);
int carry = 1;
@@ -1407,9 +1407,9 @@ inetmi(PG_FUNCTION_ARGS)
carry = pip[nb] + (~pip2[nb] & 0xFF) + carry;
lobyte = carry & 0xFF;
- if (byte <sizeof(int64))
+ if (byte < sizeof(int64))
{
- res |= ((int64) lobyte) << (byte *8);
+ res |= ((int64) lobyte) << (byte * 8);
}
else
{
@@ -1424,15 +1424,15 @@ inetmi(PG_FUNCTION_ARGS)
errmsg("result is out of range")));
}
carry >>= 8;
- byte ++;
+ byte++;
}
/*
* If input is narrower than int64, overflow is not possible, but we
* have to do proper sign extension.
*/
- if (carry == 0 && byte <sizeof(int64))
- res |= ((int64) -1) << (byte *8);
+ if (carry == 0 && byte < sizeof(int64))
+ res |= ((int64) -1) << (byte * 8);
}
PG_RETURN_INT64(res);