Module: sip-router
Branch: janakj/postgres
Commit: 72f7960fc239c3f05691be5880b0ffd8cb36968d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=72f7960…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Jul 20 17:16:17 2005 +0000
- gcc 4.0 warning & fixes "forward" ported from stable
- postgres fixes/warnings "forward" ported from stable
---
modules/db_postgres/aug_alloc.c | 5 +++--
modules/db_postgres/aug_alloc.h | 5 +++--
modules/db_postgres/aug_debug.h | 7 ++++++-
modules/db_postgres/aug_util.c | 1 -
modules/db_postgres/db_val.c | 4 ++--
modules/db_postgres/dbase.c | 4 +++-
6 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/modules/db_postgres/aug_alloc.c b/modules/db_postgres/aug_alloc.c
index 88355c8..e653456 100644
--- a/modules/db_postgres/aug_alloc.c
+++ b/modules/db_postgres/aug_alloc.c
@@ -374,7 +374,7 @@ augExport void *aug_realloc_loc(size_t size, void *prev, char *file,
int line)
return alloc;
}
-augExport void aug_free_loc(void *alloc, char *file, int line)
+augExport void aug_free_loc(const void *alloc, char *file, int line)
{
MemHead *mem, *par;
DABNAME("aug_free");
@@ -486,7 +486,8 @@ augExport void aug_foster_loc(void *alloc, void *parent, char *file,
int line)
mem->m.sibling = 0;
}
-augExport char *aug_strdup_loc(char *str, void *parent, char *file, int line)
+augExport char *aug_strdup_loc(const char *str, void *parent, char *file,
+ int line)
{
char *new;
size_t size;
diff --git a/modules/db_postgres/aug_alloc.h b/modules/db_postgres/aug_alloc.h
index 25aad8d..c9c1985 100644
--- a/modules/db_postgres/aug_alloc.h
+++ b/modules/db_postgres/aug_alloc.h
@@ -84,9 +84,10 @@ extern augNoMemFunc *aug_set_nomem_func(augNoMemFunc *new_func);
extern void *aug_alloc_loc(size_t size, void *parent, char *file, int line);
extern void *aug_realloc_loc(size_t size, void *prev, char *file, int line);
-extern char *aug_strdup_loc(char *str, void *parent, char *file, int line);
+extern char *aug_strdup_loc(const char *str, void *parent, char *file,
+ int line);
extern char **aug_vecdup_loc(char **vec, void *parent, char *file, int line);
-extern void aug_free_loc(void *mem, char *file, int line);
+extern void aug_free_loc(const void *mem, char *file, int line);
extern void aug_foster_loc(void *mem, void *new_parent, char *file, int line);
extern augAllocStats *aug_alloc_stats(void);
diff --git a/modules/db_postgres/aug_debug.h b/modules/db_postgres/aug_debug.h
index d236e22..a112489 100644
--- a/modules/db_postgres/aug_debug.h
+++ b/modules/db_postgres/aug_debug.h
@@ -126,9 +126,14 @@ extern augBool aug_dab_enabled;
#else
+#ifdef __SUNPRO_C
+ #define DABL_NOP(...) /* ignore */
+#else
+ #define DABL_NOP(args...) /* ignore */
+#endif
#define DABNAME(name)
#define DABLEVEL(lev) (augFALSE)
-#define DABL(lev) (augFALSE) &&
+#define DABL(lev) DABL_NOP
#define DAB DABL(0)
#define DABTRACE DABL(0)
#define DABBULK DABL(0)
diff --git a/modules/db_postgres/aug_util.c b/modules/db_postgres/aug_util.c
index 83d2faa..b0c8563 100644
--- a/modules/db_postgres/aug_util.c
+++ b/modules/db_postgres/aug_util.c
@@ -111,7 +111,6 @@ augExport void aug_abort(char *file, int line, char *fmt, ...)
augExport void aug_setmodule(char *name)
{
char *prog;
- int len;
if(!name)
return;
diff --git a/modules/db_postgres/db_val.c b/modules/db_postgres/db_val.c
index b885341..8f7ad1a 100644
--- a/modules/db_postgres/db_val.c
+++ b/modules/db_postgres/db_val.c
@@ -223,7 +223,7 @@ int str2valp(db_type_t _t, db_val_t* _v, const char* _s, int _l, void
*_p)
case DB_STR:
VAL_STR(_v).s = aug_alloc(_l + 1, _p);
- memcpy(_s, VAL_STR(_v).s, _l);
+ memcpy(VAL_STR(_v).s, _s, _l);
VAL_STR(_v).s[_l] = (char) 0;
VAL_STR(_v).len = _l;
VAL_TYPE(_v) = DB_STR;
@@ -248,7 +248,7 @@ int str2valp(db_type_t _t, db_val_t* _v, const char* _s, int _l, void
*_p)
case DB_BLOB:
VAL_STR(_v).s = aug_alloc(_l + 1, _p);
- memcpy(_s, VAL_STR(_v).s, _l);
+ memcpy(VAL_STR(_v).s, _s, _l);
VAL_STR(_v).s[_l] = (char) 0;
VAL_STR(_v).len = _l;
VAL_TYPE(_v) = DB_BLOB;
diff --git a/modules/db_postgres/dbase.c b/modules/db_postgres/dbase.c
index 21d3e2f..75bb54f 100644
--- a/modules/db_postgres/dbase.c
+++ b/modules/db_postgres/dbase.c
@@ -234,6 +234,7 @@ static int disconnect_db(db_con_t* _h)
db_con_t *db_init(const char* _sqlurl)
{
db_con_t* res;
+ void* t;
DLOG("db_init", "entry");
@@ -242,7 +243,8 @@ db_con_t *db_init(const char* _sqlurl)
*/
res = aug_alloc(sizeof(db_con_t), 0);
memset(res, 0, sizeof(db_con_t));
- res->tail = aug_alloc(sizeof(struct con_postgres), (char*)res);
+ t = aug_alloc(sizeof(struct con_postgres), (char*)res);
+ res->tail = (unsigned long) t;
memset((struct con_postgres*)res->tail, 0, sizeof(struct con_postgres));
if (connect_db(res, _sqlurl) < 0)