Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8a3e6b

Browse files
committed
Rename xmalloc to pg_malloc for consistency with psql usage.
Add missing plperl include.
1 parentf86c63a commite8a3e6b

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.91 2005/07/07 20:39:59 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.92 2005/07/10 16:13:12 momjian Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -144,7 +144,7 @@ static const char *backend_options = "-F -O -c search_path=pg_catalog -c exit_on
144144
staticcharbin_path[MAXPGPATH];
145145
staticcharbackend_exec[MAXPGPATH];
146146

147-
staticvoid*xmalloc(size_tsize);
147+
staticvoid*pg_malloc(size_tsize);
148148
staticchar*xstrdup(constchar*s);
149149
staticchar**replace_token(char**lines,
150150
constchar*token,constchar*replacement);
@@ -241,7 +241,7 @@ do { \
241241
* rmtree() which needs memory allocation. So we just exit with a bang.
242242
*/
243243
staticvoid*
244-
xmalloc(size_tsize)
244+
pg_malloc(size_tsize)
245245
{
246246
void*result;
247247

@@ -288,7 +288,7 @@ replace_token(char **lines, const char *token, const char *replacement)
288288
for (i=0;lines[i];i++)
289289
numlines++;
290290

291-
result= (char**)xmalloc(numlines*sizeof(char*));
291+
result= (char**)pg_malloc(numlines*sizeof(char*));
292292

293293
toklen=strlen(token);
294294
replen=strlen(replacement);
@@ -309,7 +309,7 @@ replace_token(char **lines, const char *token, const char *replacement)
309309

310310
/* if we get here a change is needed - set up new line */
311311

312-
newline= (char*)xmalloc(strlen(lines[i])+diff+1);
312+
newline= (char*)pg_malloc(strlen(lines[i])+diff+1);
313313

314314
pre=where-lines[i];
315315

@@ -341,7 +341,7 @@ filter_lines_with_token(char **lines, const char *token)
341341
for (i=0;lines[i];i++)
342342
numlines++;
343343

344-
result= (char**)xmalloc(numlines*sizeof(char*));
344+
result= (char**)pg_malloc(numlines*sizeof(char*));
345345

346346
for (src=0,dst=0;src<numlines;src++)
347347
{
@@ -397,8 +397,8 @@ readfile(char *path)
397397

398398
/* set up the result and the line buffer */
399399

400-
result= (char**)xmalloc((nlines+2)*sizeof(char*));
401-
buffer= (char*)xmalloc(maxlength+2);
400+
result= (char**)pg_malloc((nlines+2)*sizeof(char*));
401+
buffer= (char*)pg_malloc(maxlength+2);
402402

403403
/* now reprocess the file and store the lines */
404404

@@ -958,7 +958,7 @@ mkdatadir(const char *subdir)
958958
{
959959
char*path;
960960

961-
path=xmalloc(strlen(pg_data)+2+
961+
path=pg_malloc(strlen(pg_data)+2+
962962
(subdir==NULL ?0 :strlen(subdir)));
963963

964964
if (subdir!=NULL)
@@ -982,7 +982,7 @@ mkdatadir(const char *subdir)
982982
staticvoid
983983
set_input(char**dest,char*filename)
984984
{
985-
*dest=xmalloc(strlen(share_path)+strlen(filename)+2);
985+
*dest=pg_malloc(strlen(share_path)+strlen(filename)+2);
986986
sprintf(*dest,"%s/%s",share_path,filename);
987987
}
988988

@@ -1017,12 +1017,12 @@ set_short_version(char *short_version, char *extrapath)
10171017

10181018
if (extrapath==NULL)
10191019
{
1020-
path=xmalloc(strlen(pg_data)+12);
1020+
path=pg_malloc(strlen(pg_data)+12);
10211021
sprintf(path,"%s/PG_VERSION",pg_data);
10221022
}
10231023
else
10241024
{
1025-
path=xmalloc(strlen(pg_data)+strlen(extrapath)+13);
1025+
path=pg_malloc(strlen(pg_data)+strlen(extrapath)+13);
10261026
sprintf(path,"%s/%s/PG_VERSION",pg_data,extrapath);
10271027
}
10281028
version_file=fopen(path,PG_BINARY_W);
@@ -1050,7 +1050,7 @@ set_null_conf(void)
10501050
FILE*conf_file;
10511051
char*path;
10521052

1053-
path=xmalloc(strlen(pg_data)+17);
1053+
path=pg_malloc(strlen(pg_data)+17);
10541054
sprintf(path,"%s/postgresql.conf",pg_data);
10551055
conf_file=fopen(path,PG_BINARY_W);
10561056
if (conf_file==NULL)
@@ -1989,7 +1989,7 @@ escape_quotes(const char *src)
19891989
{
19901990
intlen=strlen(src),
19911991
i,j;
1992-
char*result=xmalloc(len*2+1);
1992+
char*result=pg_malloc(len*2+1);
19931993

19941994
for (i=0,j=0;i<len;i++)
19951995
{
@@ -2350,7 +2350,7 @@ main(int argc, char *argv[])
23502350
* would especially need quotes otherwise on Windows because paths
23512351
* there are most likely to have embedded spaces.
23522352
*/
2353-
pgdenv=xmalloc(8+strlen(pg_data));
2353+
pgdenv=pg_malloc(8+strlen(pg_data));
23542354
sprintf(pgdenv,"PGDATA=%s",pg_data);
23552355
putenv(pgdenv);
23562356

@@ -2385,7 +2385,7 @@ main(int argc, char *argv[])
23852385

23862386
if (!share_path)
23872387
{
2388-
share_path=xmalloc(MAXPGPATH);
2388+
share_path=pg_malloc(MAXPGPATH);
23892389
get_share_path(backend_exec,share_path);
23902390
}
23912391
elseif (!is_absolute_path(share_path))

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.58 2005/06/21 04:02:32 tgl Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.59 2005/07/10 16:13:13 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -88,7 +88,7 @@ write_stderr(const char *fmt,...)
8888
/* This extension allows gcc to check the format string for consistency with
8989
the supplied arguments. */
9090
__attribute__((format(printf,1,2)));
91-
staticvoid*xmalloc(size_tsize);
91+
staticvoid*pg_malloc(size_tsize);
9292
staticchar*xstrdup(constchar*s);
9393
staticvoiddo_advice(void);
9494
staticvoiddo_help(void);
@@ -191,7 +191,7 @@ write_stderr(const char *fmt,...)
191191
*/
192192

193193
staticvoid*
194-
xmalloc(size_tsize)
194+
pg_malloc(size_tsize)
195195
{
196196
void*result;
197197

@@ -301,8 +301,8 @@ readfile(const char *path)
301301
maxlength=linelen;
302302

303303
/* set up the result and the line buffer */
304-
result= (char**)xmalloc((nlines+1)*sizeof(char*));
305-
buffer= (char*)xmalloc(maxlength+1);
304+
result= (char**)pg_malloc((nlines+1)*sizeof(char*));
305+
buffer= (char*)pg_malloc(maxlength+1);
306306

307307
/* now reprocess the file and store the lines */
308308
rewind(infile);
@@ -539,7 +539,7 @@ do_start(void)
539539
char*postmaster_path;
540540
intret;
541541

542-
postmaster_path=xmalloc(MAXPGPATH);
542+
postmaster_path=pg_malloc(MAXPGPATH);
543543

544544
if ((ret=find_other_exec(argv0,"postmaster",PM_VERSIONSTR,
545545
postmaster_path))<0)
@@ -1353,7 +1353,7 @@ main(int argc, char **argv)
13531353
case'D':
13541354
{
13551355
char*pgdata_D;
1356-
char*env_var=xmalloc(strlen(optarg)+8);
1356+
char*env_var=pg_malloc(strlen(optarg)+8);
13571357

13581358
pgdata_D=xstrdup(optarg);
13591359
canonicalize_path(pgdata_D);
@@ -1366,7 +1366,7 @@ main(int argc, char **argv)
13661366
*variable but we do -D too for clearer
13671367
*postmaster 'ps' display
13681368
*/
1369-
pgdata_opt=xmalloc(strlen(pgdata_D)+7);
1369+
pgdata_opt=pg_malloc(strlen(pgdata_D)+7);
13701370
snprintf(pgdata_opt,strlen(pgdata_D)+7,
13711371
"-D \"%s\" ",
13721372
pgdata_D);

‎src/pl/plperl/plperl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.83 2005/07/1015:32:47 momjian Exp $
36+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.84 2005/07/1016:13:13 momjian Exp $
3737
*
3838
**********************************************************************/
3939

@@ -61,6 +61,7 @@
6161
#include"perl.h"
6262
#include"XSUB.h"
6363
#include"ppport.h"
64+
#include"spi_internal.h"
6465

6566
/* just in case these symbols aren't provided */
6667
#ifndefpTHX_

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp