mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Remove duplicate CIDR funcs by using coerce entries.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.8 1998/10/08 18:29:43 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.9 1998/10/22 13:50:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -328,6 +328,11 @@ TypeCategory(Oid inType)
|
||||
result = GEOMETRIC_TYPE;
|
||||
break;
|
||||
|
||||
case (INETOID):
|
||||
case (CIDROID):
|
||||
result = NETWORK_TYPE;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = USER_TYPE;
|
||||
break;
|
||||
@@ -379,6 +384,10 @@ PreferredType(CATEGORY category, Oid type)
|
||||
result = TIMESPANOID;
|
||||
break;
|
||||
|
||||
case (NETWORK_TYPE):
|
||||
result = INETOID;
|
||||
break;
|
||||
|
||||
case (GEOMETRIC_TYPE):
|
||||
case (USER_TYPE):
|
||||
result = type;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* is for IP V4 CIDR notation, but prepared for V6: just
|
||||
* add the necessary bits where the comments indicate.
|
||||
*
|
||||
* $Id: inet.c,v 1.12 1998/10/22 13:16:23 momjian Exp $
|
||||
* $Id: inet.c,v 1.13 1998/10/22 13:50:56 momjian Exp $
|
||||
* Jon Postel RIP 16 Oct 1998
|
||||
*/
|
||||
|
||||
@@ -297,7 +297,7 @@ inet_cmp(inet *a1, inet *a2)
|
||||
}
|
||||
|
||||
text *
|
||||
inet_host(inet *ip)
|
||||
host(inet *ip)
|
||||
{
|
||||
text *ret;
|
||||
int len;
|
||||
@@ -331,7 +331,7 @@ inet_host(inet *ip)
|
||||
ret = palloc(len);
|
||||
if (ret == NULL)
|
||||
{
|
||||
elog(ERROR, "unable to allocate memory in inet_host()");
|
||||
elog(ERROR, "unable to allocate memory in host()");
|
||||
return (NULL);
|
||||
}
|
||||
VARSIZE(ret) = len;
|
||||
@@ -339,26 +339,14 @@ inet_host(inet *ip)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
text *
|
||||
cidr_host(inet *ip)
|
||||
{
|
||||
return inet_host(ip);
|
||||
}
|
||||
|
||||
int4
|
||||
inet_netmasklen(inet *ip)
|
||||
masklen(inet *ip)
|
||||
{
|
||||
return ip_bits(ip);
|
||||
}
|
||||
|
||||
int4
|
||||
cidr_netmasklen(inet *ip)
|
||||
{
|
||||
return inet_netmasklen(ip);
|
||||
}
|
||||
|
||||
text *
|
||||
inet_broadcast(inet *ip)
|
||||
broadcast(inet *ip)
|
||||
{
|
||||
text *ret;
|
||||
int len;
|
||||
@@ -390,7 +378,7 @@ inet_broadcast(inet *ip)
|
||||
ret = palloc(len);
|
||||
if (ret == NULL)
|
||||
{
|
||||
elog(ERROR, "unable to allocate memory in inet_broadcast()");
|
||||
elog(ERROR, "unable to allocate memory in broadcast()");
|
||||
return (NULL);
|
||||
}
|
||||
VARSIZE(ret) = len;
|
||||
@@ -399,13 +387,7 @@ inet_broadcast(inet *ip)
|
||||
}
|
||||
|
||||
text *
|
||||
cidr_broadcast(inet *ip)
|
||||
{
|
||||
return inet_broadcast(ip);
|
||||
}
|
||||
|
||||
text *
|
||||
inet_netmask(inet *ip)
|
||||
netmask(inet *ip)
|
||||
{
|
||||
text *ret;
|
||||
int len;
|
||||
@@ -435,7 +417,7 @@ inet_netmask(inet *ip)
|
||||
ret = palloc(len);
|
||||
if (ret == NULL)
|
||||
{
|
||||
elog(ERROR, "unable to allocate memory in inet_netmask()");
|
||||
elog(ERROR, "unable to allocate memory in netmask()");
|
||||
return (NULL);
|
||||
}
|
||||
VARSIZE(ret) = len;
|
||||
@@ -443,12 +425,6 @@ inet_netmask(inet *ip)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
text *
|
||||
cidr_netmask(inet *ip)
|
||||
{
|
||||
return inet_netmask(ip);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise comparison for V4 addresses. Add V6 implementation!
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user