Skip to content

Commit

Permalink
xhttp_pi: clang-format for coherent indentation and coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed May 18, 2023
1 parent d5a0735 commit 0bc9de0
Show file tree
Hide file tree
Showing 5 changed files with 2,221 additions and 2,159 deletions.
31 changes: 16 additions & 15 deletions src/modules/xhttp_pi/http_db_handler.c
Expand Up @@ -32,17 +32,17 @@
#include "xhttp_pi_fnc.h"



int connect_http_db(ph_framework_t *framework_data, int index)
{
ph_db_url_t *ph_db_urls = framework_data->ph_db_urls;

if (ph_db_urls[index].http_db_handle) {
if(ph_db_urls[index].http_db_handle) {
LM_CRIT("BUG - db connection found already open\n");
return -1;
}
if ((ph_db_urls[index].http_db_handle =
ph_db_urls[index].http_dbf.init(&ph_db_urls[index].db_url)) == NULL) {
if((ph_db_urls[index].http_db_handle = ph_db_urls[index].http_dbf.init(
&ph_db_urls[index].db_url))
== NULL) {
return -1;
}
return 0;
Expand All @@ -52,34 +52,34 @@ int use_table(ph_db_table_t *db_table)
{
ph_db_url_t *db_url;

if(db_table==NULL){
if(db_table == NULL) {
LM_ERR("null db_table handler\n");
return -1;
}
if(db_table->db_url==NULL){
if(db_table->db_url == NULL) {
LM_ERR("null db_url for table [%s]\n", db_table->name.s);
return -1;
}
db_url = db_table->db_url;
if(db_url->http_db_handle==NULL){
if(db_url->http_db_handle == NULL) {
LM_ERR("null db handle for table [%s]\n", db_table->name.s);
return -1;
}
db_table->db_url->http_dbf.use_table(db_table->db_url->http_db_handle,
&db_table->name);
db_table->db_url->http_dbf.use_table(
db_table->db_url->http_db_handle, &db_table->name);
return 0;
}

int init_http_db(ph_framework_t *framework_data, int index)
{
ph_db_url_t *ph_db_urls = framework_data->ph_db_urls;

if (db_bind_mod(&ph_db_urls[index].db_url,
&ph_db_urls[index].http_dbf) < 0) {
if(db_bind_mod(&ph_db_urls[index].db_url, &ph_db_urls[index].http_dbf)
< 0) {
LM_ERR("Unable to bind to a database driver\n");
return -1;
}
if (connect_http_db(framework_data, index)!=0){
if(connect_http_db(framework_data, index) != 0) {
LM_ERR("unable to connect to the database\n");
return -1;
}
Expand All @@ -96,12 +96,13 @@ void destroy_http_db(ph_framework_t *framework_data)
int i;
ph_db_url_t *ph_db_urls;

if (framework_data == NULL) return;
if(framework_data == NULL)
return;

ph_db_urls = framework_data->ph_db_urls;
/* close the DB connections */
for(i=0;i<framework_data->ph_db_urls_size;i++){
if (ph_db_urls[i].http_db_handle) {
for(i = 0; i < framework_data->ph_db_urls_size; i++) {
if(ph_db_urls[i].http_db_handle) {
ph_db_urls[i].http_dbf.close(ph_db_urls[i].http_db_handle);
ph_db_urls[i].http_db_handle = NULL;
}
Expand Down

0 comments on commit 0bc9de0

Please sign in to comment.