Skip to content

Commit

Permalink
lib/srdb2: removed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Nov 13, 2023
1 parent fd9ccb4 commit 8764ba0
Show file tree
Hide file tree
Showing 22 changed files with 137 additions and 137 deletions.
4 changes: 2 additions & 2 deletions src/lib/srdb2/db.c
Expand Up @@ -14,8 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
6 changes: 3 additions & 3 deletions src/lib/srdb2/db.h
Expand Up @@ -14,8 +14,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -43,7 +43,7 @@ extern "C" {


/*
* Various database flags shared by modules
* Various database flags shared by modules
*/
#define SRDB_LOAD_SER (1 << 0) /* The row should be loaded by SER */
#define SRDB_DISABLED (1 << 1) /* The row is disabled */
Expand Down
26 changes: 13 additions & 13 deletions src/lib/srdb2/db_cmd.c
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2005 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,13 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_cmd.h"
Expand All @@ -33,7 +33,7 @@
#include <stdarg.h>


db_cmd_t* db_cmd(enum db_cmd_type type, db_ctx_t* ctx, char* table,
db_cmd_t* db_cmd(enum db_cmd_type type, db_ctx_t* ctx, char* table,
db_fld_t* result, db_fld_t* match, db_fld_t* values)
{
char* fname;
Expand All @@ -49,7 +49,7 @@ db_cmd_t* db_cmd(enum db_cmd_type type, db_ctx_t* ctx, char* table,
newp->ctx = ctx;

newp->table.len = strlen(table);
newp->table.s = (char*)pkg_malloc(newp->table.len + 1);
newp->table.s = (char*)pkg_malloc(newp->table.len + 1);
if (newp->table.s == NULL) goto err;
memcpy(newp->table.s, table, newp->table.len + 1);

Expand Down Expand Up @@ -152,7 +152,7 @@ db_cmd_t* db_cmd(enum db_cmd_type type, db_ctx_t* ctx, char* table,
con->uri->scheme.len, ZSW(con->uri->scheme.s));
goto err;
}

r = db_drv_func((void*)(&newp->next[i]), &con->uri->scheme, "db_next");
if (r < 0) goto err;
if (r > 0) {
Expand Down Expand Up @@ -195,7 +195,7 @@ int db_exec(db_res_t** res, db_cmd_t* cmd)
{
db_res_t* r = NULL;
int ret;

if (res) {
r = db_res(cmd);
if (r == NULL) return -1;
Expand All @@ -220,23 +220,23 @@ int db_getopt(db_cmd_t* cmd, char* optname, ...)
db_drv_func_t func;
db_con_t* con;
va_list ap;

for(i = 0; i < cmd->ctx->con_n; i++) {
con = cmd->ctx->con[i];

r = db_drv_func(&func, &con->uri->scheme, "db_getopt");
if (r < 0) return -1;
if (r > 0) func = NULL;
db_payload_idx = i;

va_start(ap, optname);
if (func && func(cmd, optname, ap) < 0) {
va_end(ap);
return -1;
}
va_end(ap);
}

return 0;
}

Expand Down
12 changes: 6 additions & 6 deletions src/lib/srdb2/db_cmd.h
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2005 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,16 +14,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _DB_CMD_H
#define _DB_CMD_H 1

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

/** \file
Expand Down Expand Up @@ -83,7 +83,7 @@ typedef struct db_cmd {
} while(0)


struct db_cmd* db_cmd(enum db_cmd_type type, struct db_ctx* ctx, char* table,
struct db_cmd* db_cmd(enum db_cmd_type type, struct db_ctx* ctx, char* table,
db_fld_t* result, db_fld_t* match, db_fld_t* value);
void db_cmd_free(struct db_cmd* cmd);

Expand Down
10 changes: 5 additions & 5 deletions src/lib/srdb2/db_con.c
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,13 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_con.h"
Expand Down
10 changes: 5 additions & 5 deletions src/lib/srdb2/db_con.h
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,16 +14,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _DB_CON_H
#define _DB_CON_H 1

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_gen.h"
Expand Down
14 changes: 7 additions & 7 deletions src/lib/srdb2/db_ctx.c
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -19,13 +19,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_ctx.h"
Expand Down Expand Up @@ -137,7 +137,7 @@ void db_ctx_free(db_ctx_t* ctx)
*/
memset(((db_gen_t*)ctx)->data, '\0', sizeof(((db_gen_t*)ctx)->data));
db_gen_free(&ctx->gen);

/* Destroy the structure */
if (ctx->id.s) pkg_free(ctx->id.s);
pkg_free(ctx);
Expand Down Expand Up @@ -221,7 +221,7 @@ int db_add_db(db_ctx_t* ctx, const char* uri)
}

/* We must create the db_con structure after lookup_ctx_data and associated
* code above, this is to ensure that db_con in the DB driver gets called
* code above, this is to ensure that db_con in the DB driver gets called
* after db_ctx in the same driver. db_con function might rely on the
* previously created context structures
*/
Expand Down
14 changes: 7 additions & 7 deletions src/lib/srdb2/db_ctx.h
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,16 +14,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _DB_CTX_H
#define _DB_CTX_H 1

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_drv.h"
Expand All @@ -45,7 +45,7 @@ struct db_ctx;
* name. A driver can have multiple connections in a context but
* it should have only one structure attached to db_ctx structure
* (which will be shared by all the connections of that driver in
* db_ctx.
* db_ctx.
*/
struct db_ctx_data {
str module;
Expand All @@ -62,7 +62,7 @@ typedef struct db_ctx {
struct db_con* con[DB_PAYLOAD_MAX];
} db_ctx_t;


/*
* Create a new database context
*/
Expand Down
24 changes: 12 additions & 12 deletions src/lib/srdb2/db_drv.c
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,13 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_drv.h"
Expand Down Expand Up @@ -57,16 +57,16 @@ int db_drv_func(db_drv_func_t* func, str* module, char* func_name)
{
static str prefix = STR_STATIC_INIT("db_");
char* buf = NULL, *name;

if ((buf = pkg_malloc(prefix.len + module->len + 1)) == NULL) {
LOG(L_ERR, "db_drv_func: No memory left\n");
goto error;
}

memcpy(buf, prefix.s, prefix.len);
memcpy(buf + prefix.len, module->s, module->len);
buf[prefix.len + module->len] = '\0';

/* First try to find the module with prefix "db_" */
name = buf;
if (find_module_by_name(name) == 0) {
Expand All @@ -77,13 +77,13 @@ int db_drv_func(db_drv_func_t* func, str* module, char* func_name)
goto error;
}
}

*func = (db_drv_func_t)find_mod_export(name, func_name, 0, 0);

if (buf) pkg_free(buf);
if (*func) return 0;
else return 1;

error:
if (buf) pkg_free(buf);
return -1;
Expand All @@ -95,7 +95,7 @@ int db_drv_func(db_drv_func_t* func, str* module, char* func_name)
* Call function with name <func_name> in DB driver <module>, give
* it pointer <db_struct> as the pointer to the corresponding DB structure
* (type of the structure is function-specific) and <offset> is the offset
* of the driver/connection within the context (used to make DB_DRV_ATTACH
* of the driver/connection within the context (used to make DB_DRV_ATTACH
* and DB_DRV_DATA macros work)
*/
int db_drv_call(str* module, char* func_name, void* db_struct, int offset)
Expand Down
12 changes: 6 additions & 6 deletions src/lib/srdb2/db_drv.h
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2001-2003 FhG FOKUS
* Copyright (C) 2006-2007 iptelorg GmbH
*
Expand All @@ -14,16 +14,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _DB_DRV_H
#define _DB_DRV_H 1

/** \ingroup DB_API
* @{
/** \ingroup DB_API
* @{
*/

#include "db_gen.h"
Expand Down Expand Up @@ -72,7 +72,7 @@ int db_drv_func(db_drv_func_t* func, str* module, char* func_name);
* Call function with name <func_name> in DB driver <module>, give
* it pointer <db_struct> as the pointer to the corresponding DB structure
* (type of the structure is function-specific) and <offset> is the offset
* of the driver/connection within the context (used to make DB_DRV_ATTACH
* of the driver/connection within the context (used to make DB_DRV_ATTACH
* and DB_DRV_DATA macros work)
*/
int db_drv_call(str* module, char* func_name, void* db_struct, int offset);
Expand Down

0 comments on commit 8764ba0

Please sign in to comment.