summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/connect.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-11-30 12:51:07 +0000
committerMichael Meskes <meskes@postgresql.org>2005-11-30 12:51:07 +0000
commitf9bdaeeb346065fe45b8761217c869c80e1c89b4 (patch)
treeee3d401c9536569d80f83b6e46482304a3ce87da /src/interfaces/ecpg/ecpglib/connect.c
parentacd3a4f3c5cce6697f0b152438b7a25288a6aff7 (diff)
- Made several variables "const char *" instead of "char *" as proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
- Replaced all strdup() calls by ECPGstrdup().
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/connect.c')
-rw-r--r--src/interfaces/ecpg/ecpglib/connect.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 26997d9f6b1..3f0bc62fa5d 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.24.4.1 2005/04/14 10:09:20 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.24.4.2 2005/11/30 12:51:06 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -260,7 +260,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
struct sqlca_t *sqlca = ECPGget_sqlca();
enum COMPAT_MODE compat = c;
struct connection *this;
- char *dbname = name ? strdup(name) : NULL,
+ char *dbname = name ? ECPGstrdup(name, lineno) : NULL,
*host = NULL,
*tmp,
*port = NULL,
@@ -282,7 +282,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if (envname)
{
ECPGfree(dbname);
- dbname = strdup(envname);
+ dbname = ECPGstrdup(envname, lineno);
}
}
@@ -302,17 +302,17 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
tmp = strrchr(dbname, ':');
if (tmp != NULL) /* port number given */
{
- port = strdup(tmp + 1);
+ port = ECPGstrdup(tmp + 1, lineno);
*tmp = '\0';
}
tmp = strrchr(dbname, '@');
if (tmp != NULL) /* host name given */
{
- host = strdup(tmp + 1);
+ host = ECPGstrdup(tmp + 1, lineno);
*tmp = '\0';
}
- realname = strdup(dbname);
+ realname = ECPGstrdup(dbname, lineno);
}
else if (strncmp(dbname, "tcp:", 4) == 0 || strncmp(dbname, "unix:", 5) == 0)
{
@@ -340,14 +340,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
tmp = strrchr(dbname + offset, '?');
if (tmp != NULL) /* options given */
{
- options = strdup(tmp + 1);
+ options = ECPGstrdup(tmp + 1, lineno);
*tmp = '\0';
}
tmp = last_dir_separator(dbname + offset);
if (tmp != NULL) /* database name given */
{
- realname = strdup(tmp + 1);
+ realname = ECPGstrdup(tmp + 1, lineno);
*tmp = '\0';
}
@@ -360,7 +360,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
if ((tmp2 = strchr(tmp + 1, ':')) != NULL)
{
*tmp2 = '\0';
- host = strdup(tmp + 1);
+ host = ECPGstrdup(tmp + 1, lineno);
if (strncmp(dbname, "unix:", 5) != 0)
{
ECPGlog("connect: socketname %s given for TCP connection in line %d\n", host, lineno);
@@ -379,7 +379,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
}
}
else
- port = strdup(tmp + 1);
+ port = ECPGstrdup(tmp + 1, lineno);
}
if (strncmp(dbname, "unix:", 5) == 0)
@@ -402,14 +402,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
}
}
else
- host = strdup(dbname + offset);
+ host = ECPGstrdup(dbname + offset, lineno);
}
else
- realname = strdup(dbname);
+ realname = ECPGstrdup(dbname, lineno);
}
else
- realname = strdup(dbname);
+ realname = ECPGstrdup(dbname, lineno);
}
else
realname = NULL;