From d0fdfe10f48cb81680e51641ff00b43f681a9bd2 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 25 Oct 2010 16:38:42 -0300 Subject: [PATCH] A bunch of minor fixes --- src/backend/commands/extension.c | 22 +++++++++++----------- src/include/commands/extension.h | 11 +++-------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 55ecc4f..64bc74f 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -58,6 +58,13 @@ #include "utils/syscache.h" #include "utils/tqual.h" + +typedef struct extension_fctx +{ + directory_fctx dir; + ExtensionList *installed; +} extension_fctx; + /* * See commands/extension.h for details. */ @@ -640,7 +647,7 @@ CreateExtension(CreateExtensionStmt *stmt) "Installing extension '%s' from '%s', %s user data", stmt->extname, control->script, - create_extension_with_user_data ? "with" : "whithout"); + create_extension_with_user_data ? "with" : "without"); /* * Force the min message settings here, because SPI will dump the @@ -801,7 +808,7 @@ get_extension_oid(const char *extname, bool missing_ok) /* * get_extension_name - given an extension OID, look up the name * - * Returns a palloc'd string, or NULL if no such tablespace. + * Returns a palloc'd string, or NULL if no such extension. */ char * get_extension_name(Oid ext_oid) @@ -841,10 +848,9 @@ get_extension_name(Oid ext_oid) /* * Drop extension by OID. This is called to clean up dependencies. */ -char * +void RemoveExtensionById(Oid extId) { - char *result; Relation rel; HeapScanDesc scandesc; HeapTuple tuple; @@ -866,16 +872,10 @@ RemoveExtensionById(Oid extId) /* We assume that there can be at most one matching tuple */ if (HeapTupleIsValid(tuple)) - result = pstrdup(NameStr(((Form_pg_extension) GETSTRUCT(tuple))->extname)); - else - result = NULL; - - simple_heap_delete(rel, &tuple->t_self); + simple_heap_delete(rel, &tuple->t_self); heap_endscan(scandesc); heap_close(rel, AccessShareLock); - - return result; } /* diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index cdb7cdc..6220513 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -49,11 +49,6 @@ typedef struct ExtensionList int maxrefs; /* current size of palloc'd array */ } ExtensionList; -typedef struct extension_fctx -{ - directory_fctx dir; - ExtensionList *installed; -} extension_fctx; typedef struct { @@ -65,9 +60,9 @@ extern void ExtensionSetCVC(void); extern void CreateExtension(CreateExtensionStmt *stmt); extern void DropExtension(DropExtensionStmt *stmt); -Oid get_extension_oid(const char *extname, bool missing_ok); -char * get_extension_name(Oid ext_oid); -char * RemoveExtensionById(Oid extId); +extern Oid get_extension_oid(const char *extname, bool missing_ok); +extern char *get_extension_name(Oid ext_oid); +extern void RemoveExtensionById(Oid extId); #endif /* EXTENSION_H */ -- 1.7.1