Department of second thoughts. Remove FRONTEND from snprintf.c because
snprintf is called before the memory system is started. We have to just malloc/free. There are no elogs in the code so we should be fine.
This commit is contained in:
parent
169adfcf74
commit
8c72526fe9
@ -15,7 +15,7 @@
|
|||||||
# for use only by the backend binaries
|
# for use only by the backend binaries
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $PostgreSQL: pgsql/src/port/Makefile,v 1.24 2005/03/20 02:44:45 momjian Exp $
|
# $PostgreSQL: pgsql/src/port/Makefile,v 1.25 2005/03/20 03:53:39 momjian Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -31,7 +31,6 @@ LIBOBJS_SRV := $(LIBOBJS)
|
|||||||
LIBOBJS_SRV := $(patsubst dirmod.o,dirmod_srv.o, $(LIBOBJS_SRV))
|
LIBOBJS_SRV := $(patsubst dirmod.o,dirmod_srv.o, $(LIBOBJS_SRV))
|
||||||
LIBOBJS_SRV := $(patsubst exec.o,exec_srv.o, $(LIBOBJS_SRV))
|
LIBOBJS_SRV := $(patsubst exec.o,exec_srv.o, $(LIBOBJS_SRV))
|
||||||
LIBOBJS_SRV := $(patsubst getaddrinfo.o,getaddrinfo_srv.o, $(LIBOBJS_SRV))
|
LIBOBJS_SRV := $(patsubst getaddrinfo.o,getaddrinfo_srv.o, $(LIBOBJS_SRV))
|
||||||
LIBOBJS_SRV := $(patsubst snprintf.o,snprintf_srv.o, $(LIBOBJS_SRV))
|
|
||||||
LIBOBJS_SRV := $(patsubst thread.o,thread_srv.o, $(LIBOBJS_SRV))
|
LIBOBJS_SRV := $(patsubst thread.o,thread_srv.o, $(LIBOBJS_SRV))
|
||||||
|
|
||||||
all: libpgport.a libpgport_srv.a
|
all: libpgport.a libpgport_srv.a
|
||||||
|
@ -32,17 +32,14 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FRONTEND
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#else
|
|
||||||
#include "postgres_fe.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** SNPRINTF, VSNPRINT -- counted versions of printf
|
** SNPRINTF, VSNPRINT -- counted versions of printf
|
||||||
**
|
**
|
||||||
@ -65,7 +62,7 @@
|
|||||||
* causing nasty effects.
|
* causing nasty effects.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.24 2005/03/17 03:18:14 momjian Exp $";*/
|
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.25 2005/03/20 03:53:39 momjian Exp $";*/
|
||||||
|
|
||||||
static void dopr(char *buffer, const char *format, va_list args, char *end);
|
static void dopr(char *buffer, const char *format, va_list args, char *end);
|
||||||
|
|
||||||
@ -227,10 +224,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
|
|||||||
for (p = format; *p != '\0'; p++)
|
for (p = format; *p != '\0'; p++)
|
||||||
if (*p == '%') /* counts %% as two, so overcounts */
|
if (*p == '%') /* counts %% as two, so overcounts */
|
||||||
percents++;
|
percents++;
|
||||||
#ifndef FRONTEND
|
|
||||||
fmtpar = pgport_palloc(sizeof(struct fmtpar) * percents);
|
|
||||||
fmtparptr = pgport_palloc(sizeof(struct fmtpar *) * percents);
|
|
||||||
#else
|
|
||||||
if ((fmtpar = malloc(sizeof(struct fmtpar) * percents)) == NULL)
|
if ((fmtpar = malloc(sizeof(struct fmtpar) * percents)) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, _("out of memory\n"));
|
fprintf(stderr, _("out of memory\n"));
|
||||||
@ -241,7 +235,6 @@ dopr(char *buffer, const char *format, va_list args, char *end)
|
|||||||
fprintf(stderr, _("out of memory\n"));
|
fprintf(stderr, _("out of memory\n"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
format_save = format;
|
format_save = format;
|
||||||
|
|
||||||
@ -586,13 +579,8 @@ nochar:
|
|||||||
}
|
}
|
||||||
*output = '\0';
|
*output = '\0';
|
||||||
|
|
||||||
#ifndef FRONTEND
|
|
||||||
pgport_pfree(fmtpar);
|
|
||||||
pgport_pfree(fmtparptr);
|
|
||||||
#else
|
|
||||||
free(fmtpar);
|
free(fmtpar);
|
||||||
free(fmtparptr);
|
free(fmtparptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user