aboutsummaryrefslogtreecommitdiff
path: root/contrib/dbsize/dbsize.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-08-29 05:07:03 +0000
committerBruce Momjian <bruce@momjian.us>2004-08-29 05:07:03 +0000
commitb6b71b85bc45b49005b5aec87cba2c33fc8baf49 (patch)
treec23dbd1dbc43972a8e48327c8a771baf36952f3d /contrib/dbsize/dbsize.c
parent90cb9c305140684b2b00c739b724f67915e11404 (diff)
downloadpostgresql-b6b71b85bc45b49005b5aec87cba2c33fc8baf49.tar.gz
postgresql-b6b71b85bc45b49005b5aec87cba2c33fc8baf49.zip
Pgindent run for 8.0.
Diffstat (limited to 'contrib/dbsize/dbsize.c')
-rw-r--r--contrib/dbsize/dbsize.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/contrib/dbsize/dbsize.c b/contrib/dbsize/dbsize.c
index b425a3979b4..9cf2c0f9369 100644
--- a/contrib/dbsize/dbsize.c
+++ b/contrib/dbsize/dbsize.c
@@ -16,7 +16,7 @@
static int64
-get_tablespace_size(Oid dbid, Oid spcid, bool baddirOK);
+ get_tablespace_size(Oid dbid, Oid spcid, bool baddirOK);
static char *
psnprintf(size_t len, const char *fmt,...)
@@ -50,10 +50,11 @@ database_size(PG_FUNCTION_ARGS)
Oid dbid;
int64 totalsize;
+
#ifdef SYMLINK
- Relation dbrel;
- HeapScanDesc scan;
- HeapTuple tuple;
+ Relation dbrel;
+ HeapScanDesc scan;
+ HeapTuple tuple;
#endif
dbid = get_database_oid(NameStr(*dbname));
@@ -62,17 +63,18 @@ database_size(PG_FUNCTION_ARGS)
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", NameStr(*dbname))));
-#ifdef SYMLINK
+#ifdef SYMLINK
- dbrel = heap_openr(TableSpaceRelationName, AccessShareLock);
+ dbrel = heap_openr(TableSpaceRelationName, AccessShareLock);
scan = heap_beginscan(dbrel, SnapshotNow, 0, (ScanKey) NULL);
totalsize = 0;
- while((tuple = heap_getnext(scan, ForwardScanDirection)))
+ while ((tuple = heap_getnext(scan, ForwardScanDirection)))
{
- Oid spcid = HeapTupleGetOid(tuple);
- if(spcid != GLOBALTABLESPACE_OID)
+ Oid spcid = HeapTupleGetOid(tuple);
+
+ if (spcid != GLOBALTABLESPACE_OID)
totalsize += get_tablespace_size(dbid, spcid, true);
}
heap_endscan(scan);
@@ -94,8 +96,8 @@ database_size(PG_FUNCTION_ARGS)
static int64
get_tablespace_size(Oid dbid, Oid spcid, bool baddirOK)
{
- char *dbpath;
- DIR *dirdesc;
+ char *dbpath;
+ DIR *dirdesc;
struct dirent *direntry;
int64 totalsize;
@@ -104,11 +106,11 @@ get_tablespace_size(Oid dbid, Oid spcid, bool baddirOK)
dirdesc = AllocateDir(dbpath);
if (!dirdesc)
{
- if(baddirOK)
+ if (baddirOK)
return 0;
else
ereport(ERROR,
- (errcode_for_file_access(),
+ (errcode_for_file_access(),
errmsg("could not open directory \"%s\": %m", dbpath)));
}
totalsize = 0;