Change indentation to follow the updated standard.
Alot of mixed indentation. use 4 chars wide soft tabs.
This commit is contained in:
parent
9cc5420447
commit
f46ae1970b
51 changed files with 634 additions and 639 deletions
|
|
@ -55,7 +55,7 @@ int database_init(dictionary *conf) {
|
|||
|
||||
char *confdb = iniparser_getstring(conf, "mongo:database", NULL);
|
||||
char *confcoll = iniparser_getstring(conf, "mongo:collection", NULL);
|
||||
|
||||
|
||||
if (!confcoll) {
|
||||
fprintf(stderr, "mongo: missing 'collection' in configuration\n");
|
||||
return -1;
|
||||
|
|
@ -67,13 +67,13 @@ int database_init(dictionary *conf) {
|
|||
|
||||
strncpy(db.opts.host, iniparser_getstring(conf, "mongo:host", "127.0.0.1"), sizeof(db.opts.host));
|
||||
db.opts.port = iniparser_getint(conf, "mongo:port", 27017);
|
||||
|
||||
|
||||
mongo_conn_return status = mongo_connect(&db.conn, &db.opts);
|
||||
|
||||
if (status != mongo_conn_success) {
|
||||
|
||||
char *err;
|
||||
|
||||
|
||||
switch (status) {
|
||||
case mongo_conn_bad_arg :
|
||||
err = "Bad arguments";
|
||||
|
|
@ -90,7 +90,7 @@ int database_init(dictionary *conf) {
|
|||
default:
|
||||
err = "Unkown error";
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "mongo: %s (%s:%i)\n", err, db.opts.host, db.opts.port);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ int database_init(dictionary *conf) {
|
|||
/* prepare collection */
|
||||
coll_clear();
|
||||
coll_create_index();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ int database_delete(const char *path, const char *filename) {
|
|||
bson_buffer_init(&buf);
|
||||
bson_append_regex(&buf, "Path", fpath, "");
|
||||
bson_from_buffer(&cond, &buf);
|
||||
|
||||
|
||||
mongo_remove(&db.conn, db.ns, &cond);
|
||||
|
||||
bson_destroy(&cond);
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ static char* escape(const char *str) {
|
|||
|
||||
size_t len = strlen(str);
|
||||
char *esc = xmalloc(len * 2 + 1);
|
||||
|
||||
|
||||
mysql_real_escape_string(db.connection, esc, str, len);
|
||||
|
||||
|
||||
return esc;
|
||||
}
|
||||
|
||||
|
|
@ -158,13 +158,13 @@ int database_insert(const char *path, const char *filename, const int isdir) {
|
|||
fprintf(stderr, "mysql: Lost connection to database. Could not reconnect\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Escape the strings */
|
||||
escaped_path = escape(path);
|
||||
escaped_filename = escape(filename);
|
||||
|
||||
stmt = xmalloc(strlen(stmt_insert) + strlen(db.table) + strlen(escaped_path) + strlen(escaped_filename) - 6);
|
||||
|
||||
|
||||
/* Create mysql query */
|
||||
sprintf(stmt, stmt_insert, db.table, escaped_path, escaped_filename, isdir != 0);
|
||||
|
||||
|
|
|
|||
Reference in a new issue