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 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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"; ...@@ -59,7 +59,7 @@ static const char BinarySignature[12] = "PGBCOPY\n\377\r\n\0";
* Static communication variables ... pretty grotty, but COPY has * Static communication variables ... pretty grotty, but COPY has
* never been reentrant... * 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; static bool fe_eof;
/* /*
...@@ -705,14 +705,14 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, ...@@ -705,14 +705,14 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
values = (Datum *) palloc(attr_count * sizeof(Datum)); values = (Datum *) palloc(attr_count * sizeof(Datum));
nulls = (char *) palloc(attr_count * sizeof(char)); nulls = (char *) palloc(attr_count * sizeof(char));
lineno = 0; copy_lineno = 0;
fe_eof = false; fe_eof = false;
while (!done) while (!done)
{ {
CHECK_FOR_INTERRUPTS(); CHECK_FOR_INTERRUPTS();
lineno++; copy_lineno++;
/* Reset the per-output-tuple exprcontext */ /* Reset the per-output-tuple exprcontext */
ResetPerTupleExprContext(estate); ResetPerTupleExprContext(estate);
...@@ -920,7 +920,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, ...@@ -920,7 +920,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp,
/* /*
* Done, clean up * Done, clean up
*/ */
lineno = 0; copy_lineno = 0;
pfree(values); pfree(values);
pfree(nulls); pfree(nulls);
......
This diff is collapsed.
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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 #ifndef COPY_H
#define COPY_H #define COPY_H
extern int lineno; extern int copy_lineno;
void DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe, void DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
char *filename, char *delim, char *null_print); char *filename, char *delim, char *null_print);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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 * OLD COMMENTS
* This file was created so that other c files could get the two * This file was created so that other c files could get the two
...@@ -21,10 +21,12 @@ ...@@ -21,10 +21,12 @@
#include <setjmp.h> #include <setjmp.h>
#include "executor/execdesc.h" #include "executor/execdesc.h"
#include "tcop/dest.h"
extern DLLIMPORT sigjmp_buf Warn_restart; extern DLLIMPORT sigjmp_buf Warn_restart;
extern bool Warn_restart_ready; extern bool Warn_restart_ready;
extern bool InError; extern bool InError;
extern CommandDest whereToSendOutput;
extern bool HostnameLookup; extern bool HostnameLookup;
extern bool ShowPortNumber; extern bool ShowPortNumber;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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 @@ ...@@ -15,36 +15,29 @@
#define ELOG_H #define ELOG_H
/* Error level codes */ /* 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 ERROR (-1) /* user error - return to known state */
#define FATAL 1 /* fatal error - abort process */ #define FATAL 1 /* fatal error - abort process */
#define REALLYFATAL 2 /* take down the other backends with me */ #define REALLYFATAL 2 /* take down the other backends with me */
#define STOP REALLYFATAL
#define DEBUG (-2) /* debug message */ #define DEBUG (-2) /* debug message */
/* temporary nonsense... */
#define STOP REALLYFATAL
#define LOG DEBUG #define LOG DEBUG
#define NOIND (-3) /* debug message, don't indent as far */
/* Configurable parameters */ /* Configurable parameters */
#ifdef ENABLE_SYSLOG #ifdef ENABLE_SYSLOG
extern int Use_syslog; extern int Use_syslog;
#endif #endif
extern bool Log_timestamp; extern bool Log_timestamp;
extern bool Log_pid; extern bool Log_pid;
#ifndef __GNUC__ extern void elog(int lev, const char *fmt,...)
extern void elog(int lev, const char *fmt,...);
#else
/* This extension allows gcc to check the format string for consistency with /* This extension allows gcc to check the format string for consistency with
the supplied arguments. */ the supplied arguments. */
extern void
elog(int lev, const char *fmt,...)
__attribute__((format(printf, 2, 3))); __attribute__((format(printf, 2, 3)));
#endif
extern int DebugFileOpen(void); extern int DebugFileOpen(void);
#endif /* ELOG_H */ #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