diff options
Diffstat (limited to 'src/backend/utils/adt/mac.c')
-rw-r--r-- | src/backend/utils/adt/mac.c | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c index fa13abe4618..aa13589b8a6 100644 --- a/src/backend/utils/adt/mac.c +++ b/src/backend/utils/adt/mac.c @@ -1,7 +1,7 @@ /* * PostgreSQL type definitions for MAC addresses. * - * $PostgreSQL: pgsql/src/backend/utils/adt/mac.c,v 1.37 2007/02/27 23:48:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/mac.c,v 1.38 2007/06/05 21:31:06 tgl Exp $ */ #include "postgres.h" @@ -145,59 +145,6 @@ macaddr_send(PG_FUNCTION_ARGS) /* - * Convert macaddr to text data type. - */ - -Datum -macaddr_text(PG_FUNCTION_ARGS) -{ - /* Input is a macaddr, but may as well leave it in Datum form */ - Datum addr = PG_GETARG_DATUM(0); - text *result; - char *str; - int len; - - str = DatumGetCString(DirectFunctionCall1(macaddr_out, addr)); - - len = (strlen(str) + VARHDRSZ); - - result = palloc(len); - - SET_VARSIZE(result, len); - memcpy(VARDATA(result), str, (len - VARHDRSZ)); - - pfree(str); - - PG_RETURN_TEXT_P(result); -} - -/* - * Convert text to macaddr data type. - */ - -Datum -text_macaddr(PG_FUNCTION_ARGS) -{ - text *addr = PG_GETARG_TEXT_P(0); - Datum result; - char str[100]; - int len; - - len = (VARSIZE(addr) - VARHDRSZ); - if (len >= sizeof(str)) - ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("text too long to convert to MAC address"))); - - memcpy(str, VARDATA(addr), len); - *(str + len) = '\0'; - - result = DirectFunctionCall1(macaddr_in, CStringGetDatum(str)); - - return result; -} - -/* * Comparison function for sorting: */ |