diff options
| author | Bruce Momjian <bruce@momjian.us> | 1998-10-22 13:51:07 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 1998-10-22 13:51:07 +0000 |
| commit | ca2995be7bf63e394d3ac80327cf5f69a1474745 (patch) | |
| tree | e22851ebab6a41664f9c452b439b7c397b2b5458 /src/backend | |
| parent | 9ac0c1e371a9fffda489a358e39130baf8e657aa (diff) | |
| download | postgresql-ca2995be7bf63e394d3ac80327cf5f69a1474745.tar.gz | |
Remove duplicate CIDR funcs by using coerce entries.
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/parser/parse_coerce.c | 11 | ||||
| -rw-r--r-- | src/backend/utils/adt/inet.c | 40 |
2 files changed, 18 insertions, 33 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 1a34e4ea58..4546922633 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -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; diff --git a/src/backend/utils/adt/inet.c b/src/backend/utils/adt/inet.c index 3afdf1437e..19d6f01702 100644 --- a/src/backend/utils/adt/inet.c +++ b/src/backend/utils/adt/inet.c @@ -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! */ |
