Skip to content

Commit 0e72b9d

Browse files
author
Neil Conway
committed
Cosmetic improvements/code cleanup:
- 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)
1 parent 86a39d5 commit 0e72b9d

File tree

11 files changed

+27
-34
lines changed

11 files changed

+27
-34
lines changed

src/backend/bootstrap/bootparse.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.73 2004/08/31 17:10:36 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.74 2004/10/10 23:37:16 neilc Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -52,15 +52,15 @@
5252

5353

5454
static void
55-
do_start()
55+
do_start(void)
5656
{
5757
StartTransactionCommand();
5858
elog(DEBUG4, "start transaction");
5959
}
6060

6161

6262
static void
63-
do_end()
63+
do_end(void)
6464
{
6565
CommitTransactionCommand();
6666
elog(DEBUG4, "commit transaction");

src/backend/bootstrap/bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.194 2004/10/08 01:36:33 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.195 2004/10/10 23:37:16 neilc Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1012,7 +1012,7 @@ EnterString(char *str)
10121012

10131013
len = strlen(str);
10141014

1015-
node = FindStr(str, len, 0);
1015+
node = FindStr(str, len, NULL);
10161016
if (node)
10171017
return node->strnum;
10181018
else

src/backend/utils/mb/wstrncmp.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
#include "mb/pg_wchar.h"
3939

4040
int
41-
pg_wchar_strncmp(s1, s2, n)
42-
register const pg_wchar *s1,
43-
*s2;
44-
register size_t n;
41+
pg_wchar_strncmp(const pg_wchar *s1, const pg_wchar *s2, size_t n)
4542
{
4643
if (n == 0)
4744
return 0;
@@ -56,10 +53,7 @@ register size_t n;
5653
}
5754

5855
int
59-
pg_char_and_wchar_strncmp(s1, s2, n)
60-
register const char *s1;
61-
register const pg_wchar *s2;
62-
register size_t n;
56+
pg_char_and_wchar_strncmp(const char *s1, const pg_wchar *s2, size_t n)
6357
{
6458
if (n == 0)
6559
return 0;
@@ -74,10 +68,9 @@ register size_t n;
7468
}
7569

7670
size_t
77-
pg_wchar_strlen(str)
78-
const pg_wchar *str;
71+
pg_wchar_strlen(const pg_wchar *str)
7972
{
80-
register const pg_wchar *s;
73+
const pg_wchar *s;
8174

8275
for (s = str; *s; ++s)
8376
;

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.241 2004/10/09 23:13:10 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.242 2004/10/10 23:37:28 neilc Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -4378,7 +4378,7 @@ DefineCustomStringVariable(
43784378
define_custom_variable(&var->gen);
43794379
}
43804380

4381-
extern void
4381+
void
43824382
EmitWarningsOnPlaceholders(const char *className)
43834383
{
43844384
struct config_generic **vars = guc_variables;

src/bin/initdb/initdb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.59 2004/10/07 18:57:26 tgl Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.60 2004/10/10 23:37:31 neilc Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -1881,7 +1881,7 @@ trapsig(int signum)
18811881
* call exit_nicely() if we got a signal, or else output "ok".
18821882
*/
18831883
static void
1884-
check_ok()
1884+
check_ok(void)
18851885
{
18861886
if (caught_signal)
18871887
{
@@ -2066,7 +2066,7 @@ main(int argc, char *argv[])
20662066
{"debug", no_argument, NULL, 'd'},
20672067
{"show", no_argument, NULL, 's'},
20682068
{"noclean", no_argument, NULL, 'n'},
2069-
{0, 0, 0, 0}
2069+
{NULL, 0, NULL, 0}
20702070
};
20712071

20722072
int c,

src/bin/pg_config/pg_config.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
1919
*
20-
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.7 2004/10/06 17:21:45 momjian Exp $
20+
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.8 2004/10/10 23:37:34 neilc Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -31,7 +31,7 @@
3131
static char *progname;
3232

3333
static void
34-
help()
34+
help(void)
3535
{
3636
printf(_("\n%s provides information about the installed version of PostgreSQL.\n\n"), progname);
3737
printf(_("Usage:\n"));
@@ -52,7 +52,7 @@ help()
5252
}
5353

5454
static void
55-
advice()
55+
advice(void)
5656
{
5757
fprintf(stderr, _("\nTry \"%s --help\" for more information\n"), progname);
5858
}

src/bin/pg_ctl/pg_ctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.32 2004/10/07 15:21:55 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.33 2004/10/10 23:37:37 neilc Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1190,7 +1190,7 @@ main(int argc, char **argv)
11901190
{"mode", required_argument, NULL, 'm'},
11911191
{"pgdata", required_argument, NULL, 'D'},
11921192
{"silent", no_argument, NULL, 's'},
1193-
{0, 0, 0, 0}
1193+
{NULL, 0, NULL, 0}
11941194
};
11951195

11961196
int option_index;

src/bin/psql/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.91 2004/09/20 18:51:19 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.92 2004/10/10 23:37:40 neilc Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -268,7 +268,7 @@ handle_sigint(SIGNAL_ARGS)
268268
* Returns whether our backend connection is still there.
269269
*/
270270
static bool
271-
ConnectionUp()
271+
ConnectionUp(void)
272272
{
273273
return PQstatus(pset.db) != CONNECTION_BAD;
274274
}

src/interfaces/ecpg/preproc/descriptor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ struct variable *
315315
descriptor_variable(const char *name, int input)
316316
{
317317
static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
318-
static const struct ECPGtype descriptor_type = {ECPGt_descriptor, 0};
318+
static const struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL};
319319
static const struct variable varspace[2] = {
320320
{descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
321321
{descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}

src/interfaces/ecpg/preproc/type.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ECPGmake_simple_type(enum ECPGttype type, char *size)
9797

9898
ne->type = type;
9999
ne->size = size;
100-
ne->u.element = 0;
100+
ne->u.element = NULL;
101101
ne->struct_sizeof = NULL;
102102

103103
return ne;
@@ -291,7 +291,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
291291
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
292292
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "Indicator for simple datatype has to be simple.\n");
293293

294-
ECPGdump_a_simple(o, name, type->type, 0, make_str("-1"), NULL, prefix);
294+
ECPGdump_a_simple(o, name, type->type, NULL, make_str("-1"), NULL, prefix);
295295
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, make_str("-1"), NULL, ind_prefix);
296296
break;
297297
default:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy