Commit 959dc927 authored by Peter Eisentraut's avatar Peter Eisentraut

Preliminary code cleanup in elog(). Split out some code into utility

functions, remove indent support, make sure all strings are marked
translatable.
parent 24775c5c
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.138 2001/06/01 02:41:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.139 2001/06/08 21:16:48 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -59,7 +59,7 @@ static const char BinarySignature[12] = "PGBCOPY\n\377\r\n\0";
* Static communication variables ... pretty grotty, but COPY has
* never been reentrant...
*/
int lineno = 0; /* exported for use by elog() -- dz */
int copy_lineno = 0; /* exported for use by elog() -- dz */
static bool fe_eof;
/*
......@@ -705,14 +705,14 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
values = (Datum *) palloc(attr_count * sizeof(Datum));
nulls = (char *) palloc(attr_count * sizeof(char));
lineno = 0;
copy_lineno = 0;
fe_eof = false;
while (!done)
{
CHECK_FOR_INTERRUPTS();
lineno++;
copy_lineno++;
/* Reset the per-output-tuple exprcontext */
ResetPerTupleExprContext(estate);
......@@ -920,7 +920,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
/*
* Done, clean up
*/
lineno = 0;
copy_lineno = 0;
pfree(values);
pfree(nulls);
......
This diff is collapsed.
......@@ -7,14 +7,14 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: copy.h,v 1.12 2001/01/24 19:43:23 momjian Exp $
* $Id: copy.h,v 1.13 2001/06/08 21:16:48 petere Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef COPY_H
#define COPY_H
extern int lineno;
extern int copy_lineno;
void DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
char *filename, char *delim, char *null_print);
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: tcopprot.h,v 1.40 2001/03/22 04:01:09 momjian Exp $
* $Id: tcopprot.h,v 1.41 2001/06/08 21:16:48 petere Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
......@@ -21,10 +21,12 @@
#include <setjmp.h>
#include "executor/execdesc.h"
#include "tcop/dest.h"
extern DLLIMPORT sigjmp_buf Warn_restart;
extern bool Warn_restart_ready;
extern bool InError;
extern CommandDest whereToSendOutput;
extern bool HostnameLookup;
extern bool ShowPortNumber;
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: elog.h,v 1.26 2001/03/22 04:01:11 momjian Exp $
* $Id: elog.h,v 1.27 2001/06/08 21:16:49 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -15,36 +15,29 @@
#define ELOG_H
/* Error level codes */
#define NOTICE 0 /* random info - no special action */
#define NOTICE 0 /* random info, sent to frontend */
#define ERROR (-1) /* user error - return to known state */
#define FATAL 1 /* fatal error - abort process */
#define REALLYFATAL 2 /* take down the other backends with me */
#define STOP REALLYFATAL
#define DEBUG (-2) /* debug message */
/* temporary nonsense... */
#define STOP REALLYFATAL
#define LOG DEBUG
#define NOIND (-3) /* debug message, don't indent as far */
/* Configurable parameters */
#ifdef ENABLE_SYSLOG
extern int Use_syslog;
#endif
extern bool Log_timestamp;
extern bool Log_pid;
#ifndef __GNUC__
extern void elog(int lev, const char *fmt,...);
#else
extern void elog(int lev, const char *fmt,...)
/* This extension allows gcc to check the format string for consistency with
the supplied arguments. */
extern void
elog(int lev, const char *fmt,...)
__attribute__((format(printf, 2, 3)));
#endif
extern int DebugFileOpen(void);
#endif /* ELOG_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment