Cosmetic improvements/code cleanup:
authorNeil Conway <neilc@samurai.com>
Sun, 10 Oct 2004 23:37:45 +0000 (23:37 +0000)
committerNeil Conway <neilc@samurai.com>
Sun, 10 Oct 2004 23:37:45 +0000 (23:37 +0000)
- replace some function signatures of the form "some_type foo()" with
"some_type foo(void)"
- replace a few instances of a literal 0 being used as a NULL pointer;
there are more instances of this in the code, but I just fixed a few
- in src/backend/utils/mb/wstrncmp.c, replace K&R style function
declarations with ANSI style, remove use of 'register' keyword
- remove an "extern" modifier that was applied to a function definition
(rather than a declaration)

src/backend/bootstrap/bootparse.y
src/backend/bootstrap/bootstrap.c
src/backend/utils/mb/wstrncmp.c
src/backend/utils/misc/guc.c
src/bin/initdb/initdb.c
src/bin/pg_config/pg_config.c
src/bin/pg_ctl/pg_ctl.c
src/bin/psql/common.c
src/interfaces/ecpg/preproc/descriptor.c
src/interfaces/ecpg/preproc/type.c
src/pl/plpgsql/src/pl_funcs.c

index 9bab19784a4bff10a203f13c62636fb4c36827f2..9c5333061e60fe49e99217f82e7204e4aab0a38a 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.73 2004/08/31 17:10:36 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.74 2004/10/10 23:37:16 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@
 
 
 static void
-do_start()
+do_start(void)
 {
    StartTransactionCommand();
    elog(DEBUG4, "start transaction");
@@ -60,7 +60,7 @@ do_start()
 
 
 static void
-do_end()
+do_end(void)
 {
    CommitTransactionCommand();
    elog(DEBUG4, "commit transaction");
index d85692cb62fefe34a4e64bfef7830a4d73d7c84f..04792c7261a2508296b5c45ddddd84b961cd2f91 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.194 2004/10/08 01:36:33 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.195 2004/10/10 23:37:16 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1012,7 +1012,7 @@ EnterString(char *str)
 
    len = strlen(str);
 
-   node = FindStr(str, len, 0);
+   node = FindStr(str, len, NULL);
    if (node)
        return node->strnum;
    else
index c1aac9c66e46296741e18dcc79ee4b64ea02e5bc..45d26f029af09d34ef2ebdeeaf51fe7547359c05 100644 (file)
 #include "mb/pg_wchar.h"
 
 int
-pg_wchar_strncmp(s1, s2, n)
-register const pg_wchar *s1,
-          *s2;
-register size_t n;
+pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n)
 {
    if (n == 0)
        return 0;
@@ -56,10 +53,7 @@ register size_t n;
 }
 
 int
-pg_char_and_wchar_strncmp(s1, s2, n)
-register const char *s1;
-register const pg_wchar *s2;
-register size_t n;
+pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n)
 {
    if (n == 0)
        return 0;
@@ -74,10 +68,9 @@ register size_t n;
 }
 
 size_t
-pg_wchar_strlen(str)
-const pg_wchar *str;
+pg_wchar_strlen(const pg_wchar *str)
 {
-   register const pg_wchar *s;
+   const pg_wchar *s;
 
    for (s = str; *s; ++s)
        ;
index a788e53266efb3bc315d2d890e3583160fe4ce97..deb361e2475c8413ff37e4bee597bdd3d8dd2ef4 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.241 2004/10/09 23:13:10 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.242 2004/10/10 23:37:28 neilc Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -4378,7 +4378,7 @@ DefineCustomStringVariable(
    define_custom_variable(&var->gen);
 }
 
-extern void
+void
 EmitWarningsOnPlaceholders(const char *className)
 {
    struct config_generic **vars = guc_variables;
index 2ed9c3c83f0a39bfb403d6b33a82c3497ab81c91..cf4f404220cb885a2b8322fd1aa73f5d79e4fb35 100644 (file)
@@ -39,7 +39,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  * Portions taken from FreeBSD.
  *
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.59 2004/10/07 18:57:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.60 2004/10/10 23:37:31 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1881,7 +1881,7 @@ trapsig(int signum)
  * call exit_nicely() if we got a signal, or else output "ok".
  */
 static void
-check_ok()
+check_ok(void)
 {
    if (caught_signal)
    {
@@ -2066,7 +2066,7 @@ main(int argc, char *argv[])
        {"debug", no_argument, NULL, 'd'},
        {"show", no_argument, NULL, 's'},
        {"noclean", no_argument, NULL, 'n'},
-       {0, 0, 0, 0}
+       {NULL, 0, NULL, 0}
    };
 
    int         c,
index 02ad203ae5e15633876570bcb2f1493b6a9233d7..58e0cd9743cf194e309eb697dee6df173acb6ace 100644 (file)
@@ -17,7 +17,7 @@
  *
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.7 2004/10/06 17:21:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.8 2004/10/10 23:37:34 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
 static char *progname;
 
 static void
-help()
+help(void)
 {
    printf(_("\n%s provides information about the installed version of PostgreSQL.\n\n"), progname);
    printf(_("Usage:\n"));
@@ -52,7 +52,7 @@ help()
 }
 
 static void
-advice()
+advice(void)
 {
    fprintf(stderr, _("\nTry \"%s --help\" for more information\n"), progname);
 }
index d756d4ca39cb1228011d0c9feaa9e803dd5c1641..3bc3cbaf2268d8875a4be491530e13cc40266a89 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.32 2004/10/07 15:21:55 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.33 2004/10/10 23:37:37 neilc Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1190,7 +1190,7 @@ main(int argc, char **argv)
        {"mode", required_argument, NULL, 'm'},
        {"pgdata", required_argument, NULL, 'D'},
        {"silent", no_argument, NULL, 's'},
-       {0, 0, 0, 0}
+       {NULL, 0, NULL, 0}
    };
 
    int         option_index;
index 27b9a290fc5392973369cb69ce2fefe0f4c4d06b..0ca6fa4f557a541600843ec02519443ae199b8e1 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2004, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.91 2004/09/20 18:51:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.92 2004/10/10 23:37:40 neilc Exp $
  */
 #include "postgres_fe.h"
 #include "common.h"
@@ -268,7 +268,7 @@ handle_sigint(SIGNAL_ARGS)
  * Returns whether our backend connection is still there.
  */
 static bool
-ConnectionUp()
+ConnectionUp(void)
 {
    return PQstatus(pset.db) != CONNECTION_BAD;
 }
index 7ba6aa520d7dcb0475514935f5f280034dfa1f48..a89eec2780ff64a43accd0299a74068e651619bf 100644 (file)
@@ -315,7 +315,7 @@ struct variable *
 descriptor_variable(const char *name, int input)
 {
    static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
-   static const struct ECPGtype descriptor_type = {ECPGt_descriptor, 0};
+   static const struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL};
    static const struct variable varspace[2] = {
        {descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
        {descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}
index 2418522204637bd5873db5d308f43d293dabddfb..c55b0ae32f6800c0446bdf2e153b1b0ac26cba80 100644 (file)
@@ -97,7 +97,7 @@ ECPGmake_simple_type(enum ECPGttype type, char *size)
 
    ne->type = type;
    ne->size = size;
-   ne->u.element = 0;
+   ne->u.element = NULL;
    ne->struct_sizeof = NULL;
 
    return ne;
@@ -291,7 +291,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
            if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
                mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
 
-           ECPGdump_a_simple(o, name, type->type, 0, make_str("-1"), NULL, prefix);
+           ECPGdump_a_simple(o, name, type->type, NULL, make_str("-1"), NULL, prefix);
            ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
            break;
        default:
index e2812e9df62675bf3b903b9f3b55d7a3c8e57404..555d0d652d5f797cf942473d95555ae5394f86ae 100644 (file)
@@ -3,7 +3,7 @@
  *           procedural language
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.37 2004/09/14 23:46:46 neilc Exp $
+ *   $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.38 2004/10/10 23:37:45 neilc Exp $
  *
  *   This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -166,7 +166,7 @@ plpgsql_ns_push(char *label)
  * ----------
  */
 void
-plpgsql_ns_pop()
+plpgsql_ns_pop(void)
 {
    int         i;
    PLpgSQL_ns *old;
@@ -503,7 +503,7 @@ static void dump_expr(PLpgSQL_expr *expr);
 
 
 static void
-dump_ind()
+dump_ind(void)
 {
    int         i;