aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r--src/backend/utils/adt/acl.c66
1 files changed, 14 insertions, 52 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 65d7794b4e4..3cf54e58750 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.139 2008/01/01 19:45:52 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.140 2008/03/25 22:42:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1313,10 +1313,7 @@ makeaclitem(PG_FUNCTION_ARGS)
static AclMode
convert_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
if (pg_strcasecmp(priv_type, "SELECT") == 0)
return ACL_SELECT;
@@ -1526,10 +1523,7 @@ convert_table_name(text *tablename)
static AclMode
convert_table_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -1736,12 +1730,9 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS)
static Oid
convert_database_name(text *databasename)
{
- char *dbname;
+ char *dbname = text_to_cstring(databasename);
Oid oid;
- dbname = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(databasename)));
-
oid = get_database_oid(dbname);
if (!OidIsValid(oid))
ereport(ERROR,
@@ -1758,10 +1749,7 @@ convert_database_name(text *databasename)
static AclMode
convert_database_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -1953,12 +1941,9 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS)
static Oid
convert_function_name(text *functionname)
{
- char *funcname;
+ char *funcname = text_to_cstring(functionname);
Oid oid;
- funcname = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(functionname)));
-
oid = DatumGetObjectId(DirectFunctionCall1(regprocedurein,
CStringGetDatum(funcname)));
@@ -1977,10 +1962,7 @@ convert_function_name(text *functionname)
static AclMode
convert_function_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -2157,12 +2139,9 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS)
static Oid
convert_language_name(text *languagename)
{
- char *langname;
+ char *langname = text_to_cstring(languagename);
Oid oid;
- langname = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(languagename)));
-
oid = GetSysCacheOid(LANGNAME,
CStringGetDatum(langname),
0, 0, 0);
@@ -2181,10 +2160,7 @@ convert_language_name(text *languagename)
static AclMode
convert_language_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -2361,12 +2337,9 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS)
static Oid
convert_schema_name(text *schemaname)
{
- char *nspname;
+ char *nspname = text_to_cstring(schemaname);
Oid oid;
- nspname = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(schemaname)));
-
oid = GetSysCacheOid(NAMESPACENAME,
CStringGetDatum(nspname),
0, 0, 0);
@@ -2385,10 +2358,7 @@ convert_schema_name(text *schemaname)
static AclMode
convert_schema_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -2569,11 +2539,9 @@ has_tablespace_privilege_id_id(PG_FUNCTION_ARGS)
static Oid
convert_tablespace_name(text *tablespacename)
{
- char *spcname;
+ char *spcname = text_to_cstring(tablespacename);
Oid oid;
- spcname = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(tablespacename)));
oid = get_tablespace_oid(spcname);
if (!OidIsValid(oid))
@@ -2591,10 +2559,7 @@ convert_tablespace_name(text *tablespacename)
static AclMode
convert_tablespace_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string
@@ -2777,10 +2742,7 @@ pg_has_role_id_id(PG_FUNCTION_ARGS)
static AclMode
convert_role_priv_string(text *priv_type_text)
{
- char *priv_type;
-
- priv_type = DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(priv_type_text)));
+ char *priv_type = text_to_cstring(priv_type_text);
/*
* Return mode from priv_type string