*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.106 2003/11/29 19:52:06 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.107 2003/12/01 22:14:40 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
#include
#include
#ifdef HAVE_PWD_H
const char *continue_parse = NULL; /* tell the mainloop where the
* backslash command ended */
-#ifdef USE_ASSERT_CHECKING
- assert(line);
-#endif
-
+ psql_assert(line);
my_line = xstrdup(line);
/*
*tmp;
size_t length;
-#ifdef USE_ASSERT_CHECKING
- assert(source);
-#endif
+ psql_assert(source);
length = Min(len, strlen(source)) + 1;
char *sys;
int result;
-#ifdef USE_ASSERT_CHECKING
- assert(fname);
-#else
- if (!fname)
- return false;
-#endif
+ psql_assert(fname);
/* Find an editor to use */
editorName = getenv("PSQL_EDITOR");
{
size_t vallen = 0;
-#ifdef USE_ASSERT_CHECKING
- assert(param);
-#else
- if (!param)
- return false;
-#endif
+ psql_assert(param);
if (value)
vallen = strlen(value);
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.30 2003/11/29 19:52:06 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.31 2003/12/01 22:14:40 momjian Exp $
*/
#ifndef COMMON_H
#define COMMON_H
#include "pqsignal.h"
#include "libpq-fe.h"
+#ifdef USE_ASSERT_CHECKING
+#define psql_assert(p) assert(p)
+#else
+#define psql_assert(p)
+#endif
+
extern char *xstrdup(const char *string);
extern bool setQFout(const char *fname);
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.34 2003/11/29 19:52:06 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.35 2003/12/01 22:14:40 momjian Exp $
*/
#include "postgres_fe.h"
#include "copy.h"
#include
#include
#include
#ifndef WIN32
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/stringutils.c,v 1.35 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/stringutils.c,v 1.36 2003/12/01 22:14:40 momjian Exp $
*/
#include "postgres_fe.h"
#include
#include "libpq-fe.h"
+#include "common.h"
#include "settings.h"
#include "stringutils.h"
char *src;
char *dst;
-#ifdef USE_ASSERT_CHECKING
- assert(source);
- assert(quote);
-#endif
+ psql_assert(source);
+ psql_assert(quote);
src = dst = source;
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.95 2003/12/01 22:08:01 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.96 2003/12/01 22:14:40 momjian Exp $
*/
/*----------------------------------------------------------------------
#ifdef USE_READLINE
#include
-#ifdef USE_ASSERT_CHECKING
-#endif
#include "libpq-fe.h"
#include "pqexpbuffer.h"
#include "common.h"
}
}
-
/*
* If we still don't have anything to match we have to fabricate some
* sort of default list. If we were to just return NULL, readline
#endif
}
-
/* free storage */
free(prev_wd);
free(prev2_wd);
directly but through the readline interface.
The return value is expected to be the full completion of the text, going
through a list each time, or NULL if there are no more matches. The string
- will be free()'d be readline, so you must run it through strdup() or
+ will be free()'d by readline, so you must run it through strdup() or
something of that sort.
*/
const char *item;
/* need to have a list */
-#ifdef USE_ASSERT_CHECKING
- assert(completion_charpp);
-#endif
+ psql_assert(completion_charpp);
/* Initialization */
if (state == 0)
(void) text; /* We don't care about what was entered
* already. */
-#ifdef USE_ASSERT_CHECKING
- assert(completion_charp);
-#endif
+ psql_assert(completion_charp);
if (state == 0)
return xstrdup(completion_charp);
else
/*
* Surround a string with single quotes. This works for both SQL and
- * psql internal. Currently disable because it is reported not to
+ * psql internal. Currently disabled because it is reported not to
* cooperate with certain versions of readline.
*/
static char *
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/variables.c,v 1.14 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/variables.c,v 1.15 2003/12/01 22:14:40 momjian Exp $
*/
#include "postgres_fe.h"
+#include "common.h"
#include "variables.h"
-
-
VariableSpace
CreateVariableSpace(void)
{
for (current = space; current; current = current->next)
{
-#ifdef USE_ASSERT_CHECKING
- assert(current->name);
- assert(current->value);
-#endif
+ psql_assert(current->name);
+ psql_assert(current->value);
if (strcmp(current->name, name) == 0)
return current->value;
}
for (current = space, previous = NULL; current; previous = current, current = current->next)
{
-#ifdef USE_ASSERT_CHECKING
- assert(current->name);
- assert(current->value);
-#endif
+ psql_assert(current->name);
+ psql_assert(current->value);
if (strcmp(current->name, name) == 0)
{
free(current->value);
for (current = space, previous = NULL; current; previous = current, current = current->next)
{
-#ifdef USE_ASSERT_CHECKING
- assert(current->name);
- assert(current->value);
-#endif
+ psql_assert(current->name);
+ psql_assert(current->value);
if (strcmp(current->name, name) == 0)
{
free(current->name);