aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-10-07 03:30:40 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-10-07 03:30:40 +0000
commitde466eb8f45da2db1a44716a31fcdfdf5080de16 (patch)
tree03e79e25f71226d06d1333b7adffbd6b4d97ceb9
parent257b4d090c96e6ca9b1c8e42c516090d7e7c8503 (diff)
downloadpostgresql-de466eb8f45da2db1a44716a31fcdfdf5080de16.tar.gz
postgresql-de466eb8f45da2db1a44716a31fcdfdf5080de16.zip
Mostly adding "const" keyword and making some functions static.
Submitted by: D'Arcy Cain
-rw-r--r--src/backend/catalog/pg_operator.c6
-rw-r--r--src/backend/include/miscadmin.h8
-rw-r--r--src/backend/utils/init/magic.c14
-rw-r--r--src/bin/pg_dump/common.c24
-rw-r--r--src/bin/pg_dump/pg_dump.c34
-rw-r--r--src/bin/pg_dump/pg_dump.h38
6 files changed, 62 insertions, 62 deletions
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 27842971299..5e241202128 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.1.1.1 1996/07/09 06:21:17 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.2 1996/10/07 03:27:48 scrappy Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -35,7 +35,7 @@
#include "fmgr.h"
static Oid OperatorGetWithOpenRelation(Relation pg_operator_desc,
- char *operatorName,
+ const char *operatorName,
Oid leftObjectId,
Oid rightObjectId );
static Oid OperatorGet(char *operatorName,
@@ -79,7 +79,7 @@ static void OperatorUpd(Oid baseId , Oid commId , Oid negId );
*/
static Oid
OperatorGetWithOpenRelation(Relation pg_operator_desc,
- char *operatorName,
+ const char *operatorName,
Oid leftObjectId,
Oid rightObjectId)
{
diff --git a/src/backend/include/miscadmin.h b/src/backend/include/miscadmin.h
index 7f8b392b734..e67691d4aad 100644
--- a/src/backend/include/miscadmin.h
+++ b/src/backend/include/miscadmin.h
@@ -12,7 +12,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.3 1996/09/19 20:02:53 scrappy Exp $
+ * $Id: miscadmin.h,v 1.4 1996/10/07 03:28:12 scrappy Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -186,8 +186,8 @@ extern ProcessingMode GetProcessingMode(void);
/*
* Prototypes for utils/init/magic.c
*/
-extern int DatabaseMetaGunkIsConsistent(char database[], char path[]);
-extern int ValidPgVersion(char path []);
-extern void SetPgVersion(char path []);
+extern int DatabaseMetaGunkIsConsistent(const char *database, char *path);
+extern int ValidPgVersion(const char *path);
+extern void SetPgVersion(const char *path);
#endif /* MISCADMIN_H */
diff --git a/src/backend/utils/init/magic.c b/src/backend/utils/init/magic.c
index 8e93ff51f5e..c56de3769b5 100644
--- a/src/backend/utils/init/magic.c
+++ b/src/backend/utils/init/magic.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/magic.c,v 1.1.1.1 1996/07/09 06:22:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/magic.c,v 1.2 1996/10/07 03:29:30 scrappy Exp $
*
* NOTES
* XXX eventually, should be able to handle version identifiers
@@ -37,7 +37,7 @@ static char Pg_verfile[] = PG_VERFILE;
/*
* private function prototypes
*/
-static void PathSetVersionFilePath(char path[], char filepathbuf[]);
+static void PathSetVersionFilePath(const char *path, char *filepathbuf);
/*
* DatabaseMetaGunkIsConsistent
@@ -48,7 +48,7 @@ static void PathSetVersionFilePath(char path[], char filepathbuf[]);
* and checking the existence of the database whether Noversion is set or not.
*/
int
-DatabaseMetaGunkIsConsistent(char *database, char *path)
+DatabaseMetaGunkIsConsistent(const char *database, char *path)
{
int isValid;
#ifndef WIN32
@@ -80,7 +80,7 @@ DatabaseMetaGunkIsConsistent(char *database, char *path)
* version number.
*/
int
-ValidPgVersion(char *path)
+ValidPgVersion(const char *path)
{
int fd;
char version[4], buf[MAXPGPATH+1];
@@ -131,7 +131,7 @@ ValidPgVersion(char *path)
* SetPgVersion - writes the version to a database directory
*/
void
-SetPgVersion(char *path)
+SetPgVersion(const char *path)
{
int fd;
char version[4], buf[MAXPGPATH+1];
@@ -159,9 +159,9 @@ SetPgVersion(char *path)
* and the name of the version file name.
*/
static void
-PathSetVersionFilePath(char *path, char *filepathbuf)
+PathSetVersionFilePath(const char *path, char *filepathbuf)
{
if (strlen(path) > (MAXPGPATH - sizeof(Pg_verfile) - 1))
elog(FATAL, "PathSetVersionFilePath: %s: path too long");
- (void) sprintf(filepathbuf, "%s%c%s", path, SEP_CHAR, Pg_verfile);
+ sprintf(filepathbuf, "%s%c%s", path, SEP_CHAR, Pg_verfile);
}
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index b7d737536aa..431f8343cc4 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.5 1996/09/16 06:05:47 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.6 1996/10/07 03:30:31 scrappy Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
@@ -42,7 +42,7 @@
*/
char*
-findTypeByOid(TypeInfo* tinfo, int numTypes, char* oid)
+findTypeByOid(TypeInfo* tinfo, int numTypes, const char* oid)
{
int i;
@@ -68,7 +68,7 @@ findTypeByOid(TypeInfo* tinfo, int numTypes, char* oid)
*
*/
char*
-findOprByOid(OprInfo *oprinfo, int numOprs, char *oid)
+findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
{
int i;
for (i=0;i<numOprs;i++) {
@@ -94,7 +94,7 @@ findOprByOid(OprInfo *oprinfo, int numOprs, char *oid)
char**
findParentsByOid(TableInfo* tblinfo, int numTables,
- InhInfo* inhinfo, int numInherits, char *oid,
+ InhInfo* inhinfo, int numInherits, const char *oid,
int *numParentsPtr)
{
int i,j;
@@ -134,7 +134,7 @@ findParentsByOid(TableInfo* tblinfo, int numTables,
*/
void
-parseArgTypes(char **argtypes, char* str)
+parseArgTypes(char **argtypes, const char* str)
{
int j, argNum;
char temp[100];
@@ -171,7 +171,7 @@ parseArgTypes(char **argtypes, char* str)
*/
int
-strInArray(char* pattern, char** arr, int arr_size)
+strInArray(const char* pattern, char** arr, int arr_size)
{
int i;
for (i=0;i<arr_size;i++) {
@@ -189,7 +189,7 @@ strInArray(char* pattern, char** arr, int arr_size)
*/
TableInfo *
-dumpSchema(FILE *fout, int *numTablesPtr, char *tablename)
+dumpSchema(FILE *fout, int *numTablesPtr, const char *tablename)
{
int numTypes;
int numFuncs;
@@ -279,7 +279,7 @@ if (!tablename && fout) {
*/
extern void
-dumpSchemaIdx(FILE *fout, int *numTablesPtr, char *tablename,
+dumpSchemaIdx(FILE *fout, int *numTablesPtr, const char *tablename,
TableInfo* tblinfo, int numTables)
{
int numIndices;
@@ -344,7 +344,7 @@ flagInhAttrs(TableInfo* tblinfo, int numTables,
*/
int
-findTableByName(TableInfo* tblinfo, int numTables, char* relname)
+findTableByName(TableInfo* tblinfo, int numTables, const char* relname)
{
int i;
for (i=0;i<numTables;i++) {
@@ -363,7 +363,7 @@ findTableByName(TableInfo* tblinfo, int numTables, char* relname)
*/
int
-findTableByOid(TableInfo* tblinfo, int numTables, char* oid)
+findTableByOid(TableInfo* tblinfo, int numTables, const char* oid)
{
int i;
for (i=0;i<numTables;i++) {
@@ -383,7 +383,7 @@ findTableByOid(TableInfo* tblinfo, int numTables, char* oid)
*/
int
-findFuncByName(FuncInfo* finfo, int numFuncs, char* name)
+findFuncByName(FuncInfo* finfo, int numFuncs, const char* name)
{
int i;
for (i=0;i<numFuncs;i++) {
@@ -399,7 +399,7 @@ findFuncByName(FuncInfo* finfo, int numFuncs, char* name)
* returns true if the relation name is an archive name, false otherwise
*/
int
-isArchiveName(char* relname)
+isArchiveName(const char* relname)
{
return (strlen(relname) > 1 && relname[1] == ',');
}
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 728dd932ca7..5de0b76d5bd 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -20,7 +20,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.9 1996/10/02 21:38:35 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.10 1996/10/07 03:30:37 scrappy Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@@ -75,7 +75,7 @@ char g_comment_end[10];
static void
-usage(char* progname)
+usage(const char* progname)
{
fprintf(stderr, "%s - version 1.13.dhb.2\n\n",progname);
fprintf(stderr, "usage: %s [options] [dbname]\n",progname);
@@ -98,7 +98,7 @@ usage(char* progname)
exit(1);
}
-void
+static void
exit_nicely(PGconn* conn)
{
PQfinish(conn);
@@ -106,18 +106,18 @@ exit_nicely(PGconn* conn)
}
-void
+int
main(int argc, char** argv)
{
int c;
- char* progname;
- char* filename;
- char* dbname;
+ const char* progname;
+ const char* filename;
+ const char* dbname;
int schemaOnly;
int dataOnly;
- char *pghost = NULL;
- char *pgport = NULL;
- char *tablename;
+ const char *pghost = NULL;
+ const char *pgport = NULL;
+ const char *tablename;
int oids;
TableInfo *tblinfo;
int numTables;
@@ -1200,7 +1200,7 @@ void dumpTables(FILE* fout, TableInfo *tblinfo, int numTables,
char **parentRels; /* list of names of parent relations */
int numParents;
int actual_atts; /* number of attrs in this CREATE statment */
- char *archiveMode;
+ const char *archiveMode;
for (i=0;i<numTables;i++) {
@@ -1300,12 +1300,12 @@ void dumpTables(FILE* fout, TableInfo *tblinfo, int numTables,
*/
void
dumpIndices(FILE* fout, IndInfo* indinfo, int numIndices,
- TableInfo* tblinfo, int numTables, char *tablename)
+ TableInfo* tblinfo, int numTables, const char *tablename)
{
int i;
int tableInd;
- char *attname; /* the name of the indexed attribute */
- char *funcname; /* the name of the function to comput the index key from*/
+ const char *attname; /* the name of the indexed attribute */
+ const char *funcname; /* the name of the function to comput the index key from*/
int indkey;
char q[MAXQUERYLEN];
@@ -1361,7 +1361,7 @@ dumpIndices(FILE* fout, IndInfo* indinfo, int numIndices,
* dump the contents of all the classes.
*/
void
-dumpClasses(TableInfo *tblinfo, int numTables, FILE *fout, char *onlytable, int oids)
+dumpClasses(TableInfo *tblinfo, int numTables, FILE *fout, const char *onlytable, int oids)
{
char query[255];
#define COPYBUFSIZ 8192
@@ -1605,7 +1605,7 @@ setMaxOid(FILE *fout)
*/
int
-findLastBuiltinOid()
+findLastBuiltinOid(void)
{
PGresult* res;
int ntups;
@@ -1634,7 +1634,7 @@ findLastBuiltinOid()
* checks a string for quote characters and quotes them
*/
char*
-checkForQuote(char* s)
+checkForQuote(const char* s)
{
char *r;
char c;
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 9d49f6e9d37..2db57cb7f64 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_dump.h,v 1.6 1996/09/23 18:15:41 scrappy Exp $
+ * $Id: pg_dump.h,v 1.7 1996/10/07 03:30:40 scrappy Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
@@ -141,27 +141,27 @@ extern char g_opaque_type[10]; /* name for the opaque type */
* common utility functions
*/
-extern TableInfo* dumpSchema(FILE* fout, int *numTablesPtr, char *tablename);
-extern void dumpSchemaIdx(FILE* fout, int *numTablesPtr, char *tablename,
+extern TableInfo* dumpSchema(FILE* fout, int *numTablesPtr, const char *tablename);
+extern void dumpSchemaIdx(FILE* fout, int *numTablesPtr, const char *tablename,
TableInfo* tblinfo, int numTables);
-extern char* findTypeByOid(TypeInfo* tinfo, int numTypes, char* oid);
-extern char* findOprByOid(OprInfo *oprinfo, int numOprs, char *oid);
-extern int findFuncByName(FuncInfo* finfo, int numFuncs, char* name);
+extern char* findTypeByOid(TypeInfo* tinfo, int numTypes, const char* oid);
+extern char* findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid);
+extern int findFuncByName(FuncInfo* finfo, int numFuncs, const char* name);
extern char** findParentsByOid(TableInfo* tbinfo, int numTables,
InhInfo* inhinfo, int numInherits,
- char *oid,
+ const char *oid,
int *numParents);
-extern int findTableByName(TableInfo *tbinfo, int numTables, char *relname);
-extern int findTableByOid(TableInfo *tbinfo, int numTables, char *oid);
+extern int findTableByName(TableInfo *tbinfo, int numTables, const char *relname);
+extern int findTableByOid(TableInfo *tbinfo, int numTables, const char *oid);
extern void flagInhAttrs(TableInfo* tbinfo, int numTables,
InhInfo* inhinfo, int numInherits);
-extern void check_conn_and_db();
-extern char* dupstr(char *s);
-extern int strInArray(char* pattern, char** arr, int arr_size);
-extern void parseArgTypes(char **argtypes, char* str);
-extern int isArchiveName(char*);
+extern void check_conn_and_db(void);
+extern char* dupstr(const char *s);
+extern int strInArray(const char* pattern, char** arr, int arr_size);
+extern void parseArgTypes(char **argtypes, const char* str);
+extern int isArchiveName(const char*);
/*
* version specific routines
@@ -186,16 +186,16 @@ extern void dumpOneFunc(FILE* fout, FuncInfo* finfo, int i,
TypeInfo *tinfo, int numTypes);
extern void dumpTables(FILE* fout, TableInfo* tbinfo, int numTables,
InhInfo *inhinfo, int numInherits,
- TypeInfo *tinfo, int numTypes, char *tablename);
+ TypeInfo *tinfo, int numTypes, const char *tablename);
extern void dumpIndices(FILE* fout, IndInfo* indinfo, int numIndices,
- TableInfo* tbinfo, int numTables, char *tablename);
+ TableInfo* tbinfo, int numTables, const char *tablename);
extern void dumpClasses(TableInfo *tbinfo, int numTables, FILE *fout,
- char *tablename, int oids);
+ const char *tablename, int oids);
extern void dumpTuples(PGresult *res, FILE *fout, int *attrmap);
extern void setMaxOid(FILE *fout);
-extern char* checkForQuote(char* s);
-extern int findLastBuiltinOid();
+extern char* checkForQuote(const char* s);
+extern int findLastBuiltinOid(void);
/* largest query string size */