[PATCH] Renamed db_res_t to db1_res_t to avoid conflicts with libsrdb2.

Jan Janak jan at iptel.org
Thu Feb 12 20:16:40 CET 2009


---
 lib/srdb1/db.c       |    2 +-
 lib/srdb1/db.h       |    8 ++++----
 lib/srdb1/db_query.c |    8 ++++----
 lib/srdb1/db_query.h |    8 ++++----
 lib/srdb1/db_res.c   |   20 ++++++++++----------
 lib/srdb1/db_res.h   |   16 ++++++++--------
 lib/srdb1/db_row.c   |    2 +-
 lib/srdb1/db_row.h   |    2 +-
 8 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/lib/srdb1/db.c b/lib/srdb1/db.c
index 16fa907..c705aea 100644
--- a/lib/srdb1/db.c
+++ b/lib/srdb1/db.c
@@ -338,7 +338,7 @@ int db_table_version(const db_func_t* dbf, db1_con_t* connection, const str* tab
 {
 	db_key_t key[1], col[1];
 	db_val_t val[1];
-	db_res_t* res = NULL;
+	db1_res_t* res = NULL;
 	db_val_t* ver = 0;
 
 	if (!dbf||!connection || !table || !table->s) {
diff --git a/lib/srdb1/db.h b/lib/srdb1/db.h
index 2f819ae..1064ed3 100644
--- a/lib/srdb1/db.h
+++ b/lib/srdb1/db.h
@@ -129,7 +129,7 @@ typedef void (*db_close_f) (db1_con_t* _h);
  */
 typedef int (*db_query_f) (const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 				const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-				const db_key_t _o, db_res_t** _r);
+				const db_key_t _o, db1_res_t** _r);
 
 /**
  * \brief Gets a partial result set, fetch rows from a result
@@ -146,7 +146,7 @@ typedef int (*db_query_f) (const db1_con_t* _h, const db_key_t* _k, const db_op_
  * \param _n the number of rows that should be fetched
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
-typedef int (*db_fetch_result_f) (const db1_con_t* _h, db_res_t** _r, const int _n);
+typedef int (*db_fetch_result_f) (const db1_con_t* _h, db1_res_t** _r, const int _n);
 
 
 /**
@@ -164,7 +164,7 @@ typedef int (*db_fetch_result_f) (const db1_con_t* _h, db_res_t** _r, const int
  * \param _r structure for the result
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
-typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db_res_t** _r);
+typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db1_res_t** _r);
 
 
 /**
@@ -177,7 +177,7 @@ typedef int (*db_raw_query_f) (const db1_con_t* _h, const str* _s, db_res_t** _r
  * \param _r pointer to db_res_t structure to destroy
  * \return returns 0 if everything is OK, otherwise returns value < 0
  */
-typedef int (*db_free_result_f) (db1_con_t* _h, db_res_t* _r);
+typedef int (*db_free_result_f) (db1_con_t* _h, db1_res_t* _r);
 
 
 /**
diff --git a/lib/srdb1/db_query.c b/lib/srdb1/db_query.c
index a540c30..2d24974 100644
--- a/lib/srdb1/db_query.c
+++ b/lib/srdb1/db_query.c
@@ -42,9 +42,9 @@ static char sql_buf[SQL_BUF_LEN];
 
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-	const db_key_t _o, db_res_t** _r, int (*val2str) (const db1_con_t*,
+	const db_key_t _o, db1_res_t** _r, int (*val2str) (const db1_con_t*,
 	const db_val_t*, char*, int* _len), int (*submit_query)(const db1_con_t*,
-	const str*), int (*store_result)(const db1_con_t* _h, db_res_t** _r))
+	const str*), int (*store_result)(const db1_con_t* _h, db1_res_t** _r))
 {
 	int off, ret;
 
@@ -117,9 +117,9 @@ error:
 }
 
 
-int db_do_raw_query(const db1_con_t* _h, const str* _s, db_res_t** _r,
+int db_do_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r,
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
-	int (*store_result)(const db1_con_t* _h, db_res_t** _r))
+	int (*store_result)(const db1_con_t* _h, db1_res_t** _r))
 {
 	if (!_h || !_s || !submit_query || !store_result) {
 		LM_ERR("invalid parameter value\n");
diff --git a/lib/srdb1/db_query.h b/lib/srdb1/db_query.h
index 3dbf1a4..9cbc224 100644
--- a/lib/srdb1/db_query.h
+++ b/lib/srdb1/db_query.h
@@ -68,9 +68,9 @@
  */
 int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
 	const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
-	const db_key_t _o, db_res_t** _r, int (*val2str) (const db1_con_t*,
+	const db_key_t _o, db1_res_t** _r, int (*val2str) (const db1_con_t*,
 	const db_val_t*, char*, int*), int (*submit_query)(const db1_con_t* _h,
-	const str* _c), int (*store_result)(const db1_con_t* _h, db_res_t** _r));
+	const str* _c), int (*store_result)(const db1_con_t* _h, db1_res_t** _r));
 
 
 /**
@@ -88,9 +88,9 @@ int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
  * \param (*store_result) function pointer to the db specific store result function
  * \return zero on success, negative on errors
  */
-int db_do_raw_query(const db1_con_t* _h, const str* _s, db_res_t** _r,
+int db_do_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r,
 	int (*submit_query)(const db1_con_t* _h, const str* _c),
-	int (*store_result)(const db1_con_t* _h, db_res_t** _r));
+	int (*store_result)(const db1_con_t* _h, db1_res_t** _r));
 
 
 /**
diff --git a/lib/srdb1/db_res.c b/lib/srdb1/db_res.c
index b723bdf..16685a8 100644
--- a/lib/srdb1/db_res.c
+++ b/lib/srdb1/db_res.c
@@ -41,7 +41,7 @@
 /*
  * Release memory used by rows
  */
-inline int db_free_rows(db_res_t* _r)
+inline int db_free_rows(db1_res_t* _r)
 {
 	int i;
 
@@ -68,7 +68,7 @@ inline int db_free_rows(db_res_t* _r)
 /*
  * Release memory used by columns
  */
-inline int db_free_columns(db_res_t* _r)
+inline int db_free_columns(db1_res_t* _r)
 {
 	int col;
 
@@ -104,24 +104,24 @@ inline int db_free_columns(db_res_t* _r)
 /*
  * Create a new result structure and initialize it
  */
-inline db_res_t* db_new_result(void)
+inline db1_res_t* db_new_result(void)
 {
-	db_res_t* r = NULL;
-	r = (db_res_t*)pkg_malloc(sizeof(db_res_t));
+	db1_res_t* r = NULL;
+	r = (db1_res_t*)pkg_malloc(sizeof(db1_res_t));
 	if (!r) {
 		LM_ERR("no private memory left\n");
 		return 0;
 	}
 	LM_DBG("allocate %d bytes for result set at %p\n",
-		(int)sizeof(db_res_t), r);
-	memset(r, 0, sizeof(db_res_t));
+		(int)sizeof(db1_res_t), r);
+	memset(r, 0, sizeof(db1_res_t));
 	return r;
 }
 
 /*
  * Release memory used by a result structure
  */
-inline int db_free_result(db_res_t* _r)
+inline int db_free_result(db1_res_t* _r)
 {
 	if (!_r)
 	{
@@ -141,7 +141,7 @@ inline int db_free_result(db_res_t* _r)
  * Allocate storage for column names and type in existing
  * result structure.
  */
-inline int db_allocate_columns(db_res_t* _r, const unsigned int cols)
+inline int db_allocate_columns(db1_res_t* _r, const unsigned int cols)
 {
 	RES_NAMES(_r) = (db_key_t*)pkg_malloc(sizeof(db_key_t) * cols);
 	if (!RES_NAMES(_r)) {
@@ -171,7 +171,7 @@ inline int db_allocate_columns(db_res_t* _r, const unsigned int cols)
  * \param _res result set
  * \return zero on success, negative on errors
  */
-inline int db_allocate_rows(db_res_t* _res)
+inline int db_allocate_rows(db1_res_t* _res)
 {
 	int len = sizeof(db_row_t) * RES_ROW_N(_res);
 	RES_ROWS(_res) = (struct db_row*)pkg_malloc(len);
diff --git a/lib/srdb1/db_res.h b/lib/srdb1/db_res.h
index dde8242..40eb09c 100644
--- a/lib/srdb1/db_res.h
+++ b/lib/srdb1/db_res.h
@@ -51,7 +51,7 @@ struct db_row;
  * In addition to zero or more rows, each db_res_t object contains also an array
  * of db_key_t objects. The objects represent keys (names of columns). *
  */
-typedef struct db_res {
+typedef struct db1_res {
 	struct {
 		db_key_t* names;   /**< Column names                    */
 		db_type_t* types;  /**< Column types                    */
@@ -61,7 +61,7 @@ typedef struct db_res {
 	int n;                 /**< Number of rows in current fetch */
 	int res_rows;          /**< Number of total rows in query   */
 	int last_row;          /**< Last row                        */
-} db_res_t;
+} db1_res_t;
 
 
 /** Return the column names */
@@ -85,7 +85,7 @@ typedef struct db_res {
  * \param _r the result that should be released
  * \return zero on success, negative on errors
  */
-inline int db_free_rows(db_res_t* _r);
+inline int db_free_rows(db1_res_t* _r);
 
 
 /**
@@ -95,20 +95,20 @@ inline int db_free_rows(db_res_t* _r);
  * \param _r the result that should be released
  * \return zero on success, negative on errors
  */
-inline int db_free_columns(db_res_t* _r);
+inline int db_free_columns(db1_res_t* _r);
 
 
 /**
  * Create a new result structure and initialize it.
  * \return a pointer to the new result on success, NULL on errors
  */
-inline db_res_t* db_new_result(void);
+inline db1_res_t* db_new_result(void);
 
 /**
  * Release memory used by a result structure.
  * \return zero on success, negative on errors
  */
-inline int db_free_result(db_res_t* _r);
+inline int db_free_result(db1_res_t* _r);
 
 /**
  * Allocate storage for column names and type in existing result structure.
@@ -118,7 +118,7 @@ inline int db_free_result(db_res_t* _r);
  * \param cols number of columns
  * \return zero on success, negative on errors
  */
-inline int db_allocate_columns(db_res_t* _r, const unsigned int cols);
+inline int db_allocate_columns(db1_res_t* _r, const unsigned int cols);
 
 
 /**
@@ -126,6 +126,6 @@ inline int db_allocate_columns(db_res_t* _r, const unsigned int cols);
  * \param _res result set
  * \return zero on success, negative on errors
  */
-inline int db_allocate_rows(db_res_t* _res);
+inline int db_allocate_rows(db1_res_t* _res);
 
 #endif /* DB_RES_H */
diff --git a/lib/srdb1/db_row.c b/lib/srdb1/db_row.c
index 8e12903..449f3fd 100644
--- a/lib/srdb1/db_row.c
+++ b/lib/srdb1/db_row.c
@@ -108,7 +108,7 @@ inline int db_free_row(db_row_t* _r)
  * \param _row filled row
  * \return zero on success, negative on errors
  */
-inline int db_allocate_row(const db_res_t* _res, db_row_t* _row)
+inline int db_allocate_row(const db1_res_t* _res, db_row_t* _row)
 {
 	int len = sizeof(db_val_t) * RES_COL_N(_res);
 	ROW_VALUES(_row) = (db_val_t*)pkg_malloc(len);
diff --git a/lib/srdb1/db_row.h b/lib/srdb1/db_row.h
index b786dba..81a53e6 100644
--- a/lib/srdb1/db_row.h
+++ b/lib/srdb1/db_row.h
@@ -71,6 +71,6 @@ inline int db_free_row(db_row_t* _r);
  * \param _row filled row
  * \return zero on success, negative on errors
  */
-inline int db_allocate_row(const db_res_t* _res, db_row_t* _row);
+inline int db_allocate_row(const db1_res_t* _res, db_row_t* _row);
 
 #endif /* DB_ROW_H */
-- 
1.5.6.5


--7ZAtKRhVyVSsbBD2
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0004-Renamed-db_res_t-to-db1_res_t-in-doxygen-documentati.patch"



More information about the sr-dev mailing list