diff --git a/src/base/commands.c b/src/base/commands.c index 96c7c65a6a3588db6ae63814e60051526f18349a..ee0e36b370715f7f3e661b5c631731f6ff6b7a2e 100644 --- a/src/base/commands.c +++ b/src/base/commands.c @@ -25,7 +25,7 @@ command_restart(struct lkt_state *srv, size_t c) struct lkt_queue_state sta = {0}; RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false); if (!executable_name) { - LOG_ERROR("GENERAL", "%s", "Can't restart if the executable path was not found at start-up"); + LOG_ERROR("GENERAL", "Can't restart if the executable path was not found at start-up"); return false; } close(srv->fds[0].fd); @@ -46,7 +46,7 @@ command_restart(struct lkt_state *srv, size_t c) env_set(LKT_ENV_CURRENT, "NULL"); database_close_all(); execv(executable_name, (char *const *) argv); - LOG_ERROR("GENERAL", "%s", "Failed to exec lektor or OS not supported"); + LOG_ERROR("GENERAL", "Failed to exec lektor or OS not supported"); return false; } @@ -83,7 +83,7 @@ command_rescan(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX] // return ! mthread_create(NULL, ATTR_DETACHED_FREE, __rescan, args); /* TODO: Use the repo module. */ (void) __rescan; - LOG_ERROR("GENERAL", "%s", "Not implemented"); + LOG_ERROR("GENERAL", "Not implemented"); return false; } @@ -91,7 +91,7 @@ inline bool command_kill(struct lkt_state *srv, size_t c) { RETURN_UNLESS(lkt_client_auth(srv, c, false), "Failed to authentificate user", false); - LOG_INFO("GENERAL", "%s", "Stopping lektord"); + LOG_INFO("GENERAL", "Stopping lektord"); close(srv->fds[0].fd); lkt_queue_free(&srv->queue); database_close_all(); @@ -108,7 +108,7 @@ command_currentsong(struct lkt_state *srv, size_t c) memset(&kara, 0, sizeof(struct kara_metadata)); if (!database_queue_current_kara(srv->db, &kara, NULL)) - LOG_ERROR("COMMAND", "%s", "Failed to get information about the current kara"); + LOG_ERROR("COMMAND", "Failed to get information about the current kara"); out = lkt_message_new(); idx = safe_snprintf(out->data, LKT_MESSAGE_MAX, @@ -493,7 +493,7 @@ __iter_search(struct lkt_search *search) if (count) lkt_set_continuation(search->srv, search->c, search->continuation + count); else - LOG_WARN("COMMAND", "%s", "Nothing found"); + LOG_WARN("COMMAND", "Nothing found"); return true; } @@ -638,7 +638,7 @@ command_plt_add(struct lkt_state *srv, char *args[LKT_MESSAGE_ARGS_MAX]) else { if (!lkt_uri_from(&uri, args[1])) { - LOG_ERROR("COMMAND", "%s", "Failed to get uri"); + LOG_ERROR("COMMAND", "Failed to get uri"); goto end_plt_add_uri; } @@ -913,7 +913,7 @@ command_sticker_get(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS return true; unknown: - LOG_ERROR("COMMAND", "%s", "Specified command is invalid or unknown"); + LOG_ERROR("COMMAND", "Specified command is invalid or unknown"); return false; } diff --git a/src/base/config.c b/src/base/config.c index 0627b348f5cf15a49239f13bfd85a79d2c1569bf..aeb955a0b1f65b4bc0e947f6da8680f5a75d4f52 100644 --- a/src/base/config.c +++ b/src/base/config.c @@ -57,7 +57,7 @@ __set_log_level(const char *name, const char *level) } if (!level[0]) { - LOG_WARN("CONFIG", "%s", "Invalid empty 'log' option"); + LOG_WARN("CONFIG", "Invalid empty 'log' option"); return; } @@ -252,7 +252,7 @@ config_new(volatile sqlite3 *db, const char *conf) return 0; error: - LOG_ERROR("CONFIG", "%s", "Errors detected, here is a default config"); + LOG_ERROR("CONFIG", "Errors detected, here is a default config"); config_default(stdout); return 1; } diff --git a/src/base/thread.c b/src/base/thread.c index 72014fd0f6600f65f62f767c245af5fd2ada24a8..0ef3bca850c6bb6dcd19f4ddc03d69b1194b1597 100644 --- a/src/base/thread.c +++ b/src/base/thread.c @@ -46,15 +46,15 @@ poller_new(struct poller_thread *th, void *(*func)(struct poller_thread_arg *), __args->arg->self = th; if (pthread_create(&(th->th), NULL, __start, __args)) { - LOG_ERROR("THREAD", "%s", "Failed to create a poller thread"); + LOG_ERROR("THREAD", "Failed to create a poller thread"); return 1; } - LOG_INFO("THREAD", "%s", "Create a new poller thread"); + LOG_INFO("THREAD", "Create a new poller thread"); return 0; out_of_memory: - LOG_ERROR("MEMORY", "%s", "Out of memory"); + LOG_ERROR("MEMORY", "Out of memory"); stack_free(&th_.input); stack_free(&th_.output); return 1; @@ -66,11 +66,11 @@ poller_join(struct poller_thread *th, void **ret) int sta = pthread_join(th->th, ret); if (sta) - LOG_ERROR("THREAD", "%s", "Failed to join thread"); + LOG_ERROR("THREAD", "Failed to join thread"); stack_free(&th->input); stack_free(&th->output); - LOG_WARN("THREAD", "%s", "Thread joined"); + LOG_WARN("THREAD", "Thread joined"); memset(th, 0, sizeof(struct poller_thread)); return sta; diff --git a/src/database/find.c b/src/database/find.c index 3d123eaf971cc434985e612012f27cbb5a66577e..9e9a910d6b9211f0553e31750f021731b644fe7e 100644 --- a/src/database/find.c +++ b/src/database/find.c @@ -33,10 +33,10 @@ database_search_database_init(volatile sqlite3 *db, struct lkt_search *ret) SQLITE_PREPARE(db, ret->stmt, SQL_STMT, error); if (!ret->ka_uri.is_int) { SQLITE_BIND_TEXT(db, ret->stmt, 1, ret->ka_uri.value, error); - LOG_DEBUG("DB", "%s", "Uri was a text"); + LOG_DEBUG("DB", "Uri was a text"); } else { SQLITE_BIND_INT(db, ret->stmt, 1, (int) ret->ka_uri.id, error); - LOG_DEBUG("DB", "%s", "Uri was a size_t"); + LOG_DEBUG("DB", "Uri was a size_t"); } ret->db = db; return true; @@ -85,10 +85,10 @@ database_search_playlist_init(volatile sqlite3 *db, struct lkt_search *ret) SQLITE_BIND_TEXT(db, ret->stmt, 1, ret->plt_name, error); if (!ret->ka_uri.is_int) { SQLITE_BIND_TEXT(db, ret->stmt, 2, ret->ka_uri.value, error); - LOG_DEBUG("DB", "%s", "Uri was a text"); + LOG_DEBUG("DB", "Uri was a text"); } else { SQLITE_BIND_INT(db, ret->stmt, 2, (int) ret->ka_uri.id, error); - LOG_DEBUG("DB", "%s", "Uri was a size_t"); + LOG_DEBUG("DB", "Uri was a size_t"); } return true; @@ -191,10 +191,10 @@ database_search_queue_init(volatile sqlite3 *db, struct lkt_search *ret) SQLITE_PREPARE(db, ret->stmt, SQL_STMT, error); if (!ret->ka_uri.is_int) { SQLITE_BIND_TEXT(db, ret->stmt, 1, ret->ka_uri.value, error); - LOG_DEBUG("DB", "%s", "Uri was a text"); + LOG_DEBUG("DB", "Uri was a text"); } else { SQLITE_BIND_INT(db, ret->stmt, 1, (int) ret->ka_uri.id, error); - LOG_DEBUG("DB", "%s", "Uri was a size_t"); + LOG_DEBUG("DB", "Uri was a size_t"); } ret->db = db; return true; diff --git a/src/database/open.c b/src/database/open.c index dc500f6b25f6723d10e04a4572e23dda7990a3e9..47f9a0de808de4032b90b30c4242dc713d36495b 100644 --- a/src/database/open.c +++ b/src/database/open.c @@ -40,13 +40,13 @@ __dec(volatile sqlite3 *db, const char *name) LOG_INFO("DB", "Dec open count on db '%s'", name); return; error: - LOG_ERROR("DB", "%s", "Faield to close database"); + LOG_ERROR("DB", "Faield to close database"); } void database_close_all(void) { - LOG_INFO("GARBAGE", "%s", "Closing all db"); + LOG_INFO("GARBAGE", "Closing all db"); if (pthread_mutex_trylock(&mtx)) return; struct named_db *item; @@ -56,7 +56,7 @@ database_close_all(void) free((void *) item->name); free(item); } - LOG_INFO("GARBAGE", "%s", "All db closed"); + LOG_INFO("GARBAGE", "All db closed"); stack_free(&db_stack); } @@ -81,7 +81,7 @@ __inc(volatile sqlite3 *db, const char *name, bool check) exit(EXIT_FAILURE); return; error: - LOG_ERROR("DB", "%s", "Database already in use"); + LOG_ERROR("DB", "Database already in use"); if (check) exit(EXIT_FAILURE); __dec(db, name); @@ -167,7 +167,7 @@ __check_schema(volatile sqlite3 *db) if (9 != sqlite3_column_int(stmt, 0)) return true; error: - LOG_ERROR("DB", "%s", "Schema is invalid: missing tables"); + LOG_ERROR("DB", "Schema is invalid: missing tables"); return false; } diff --git a/src/database/queue.c b/src/database/queue.c index 400907491a3375b9a03110b91dc25996ad7ec65a..7e66079bacee086579dbb58b856f7521472fb5de 100644 --- a/src/database/queue.c +++ b/src/database/queue.c @@ -118,9 +118,9 @@ error: #define reorder(db, prio, error) \ if (prio > 1) { \ if (__queue_reorder(db)) { \ - LOG_INFO("DB", "%s", "Queue has been reordered"); \ + LOG_INFO("DB", "Queue has been reordered"); \ } else { \ - LOG_INFO("DB", "%s", "Failed to reorder"); \ + LOG_INFO("DB", "Failed to reorder"); \ goto error; \ } \ } @@ -339,7 +339,7 @@ database_queue_next(volatile sqlite3 *db, char filepath[PATH_MAX]) } else if (code == SQLITE_DONE) { - LOG_ERROR("DB", "%s", "Failed to get next"); + LOG_ERROR("DB", "Failed to get next"); goto error; } @@ -403,7 +403,7 @@ database_queue_prev(volatile sqlite3 *db, char filepath[PATH_MAX]) } else if (code == SQLITE_DONE) { - LOG_ERROR("DB", "%s", "Failed to get previous"); + LOG_ERROR("DB", "Failed to get previous"); goto error; } @@ -445,7 +445,7 @@ database_queue_move(volatile sqlite3 *db, int from, int to) code = sqlite3_step(stmt); if (code != SQLITE_ROW && code != SQLITE_DONE && code != SQLITE_OK) { - LOG_ERROR("DB", "%s", "Move failed"); + LOG_ERROR("DB", "Move failed"); goto error; } diff --git a/src/main/server.c b/src/main/server.c index 9d593a9e0740e8d1560a365f99304748aa48bcf7..2f79850950d01f28b8fd75c52eda0a677105dff8 100644 --- a/src/main/server.c +++ b/src/main/server.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) reg_export(server_reg); if (read_self_exe(exe, PATH_MAX)) - LOG_WARN("GENERAL", "%s", "Failed to read self executable path, " + LOG_WARN("GENERAL", "Failed to read self executable path, " "restart may not work"); executable_name = exe; @@ -67,23 +67,23 @@ main(int argc, char *argv[]) .kara_prefix = kara_dir, }; if (lkt_queue_new(&srv.queue)) { - LOG_ERROR("INIT", "%s", "Faield to create server queue"); + LOG_ERROR("INIT", "Faield to create server queue"); exit(EXIT_FAILURE); } /* Initialize the system. */ if (!database_new(&srv.db)) { - LOG_ERROR("INIT", "%s", "Failed to init memory db"); + LOG_ERROR("INIT", "Failed to init memory db"); exit(EXIT_FAILURE); } if (conf_file[0] == '\0' && config_detect_file(conf_file, PATH_MAX)) { - LOG_ERROR("INIT", "%s", "Failed to find a config file"); + LOG_ERROR("INIT", "Failed to find a config file"); exit(EXIT_FAILURE); } if (config_new(srv.db, conf_file)) { - LOG_ERROR("INIT", "%s", "Failed to read the config"); + LOG_ERROR("INIT", "Failed to read the config"); exit(EXIT_FAILURE); } free(conf_file); diff --git a/src/mkv/utils.c b/src/mkv/utils.c index 07a3292a3feee1bd9d3a9007fd1ac0ab3e03744a..fb3b82bc16f6c070ed123d28241773df38e7ab9c 100644 --- a/src/mkv/utils.c +++ b/src/mkv/utils.c @@ -16,7 +16,7 @@ mdtcat(struct kara_metadata *mdt, char **ret) long_length(mdt->song_number); *ret = malloc(sizeof(char) * size); if (!*ret) { - LOG_ERROR("MKV", "%s", "Out of memory"); + LOG_ERROR("MKV", "Out of memory"); return; } diff --git a/src/mkv/write.c b/src/mkv/write.c index 5f3d5b74b15db108c762b179030e1745c6a9219b..8c54807f6c0aa8d977175ebc82cfa66a84914aa3 100644 --- a/src/mkv/write.c +++ b/src/mkv/write.c @@ -66,13 +66,13 @@ mkvpropedit__(const char *const args[]) if ((pid = fork()) == 0) { if ((fd = open("/dev/null", O_WRONLY | O_TRUNC)) < 0) { - LOG_ERROR("FORK", "%s", "Can't to open /dev/null " + LOG_ERROR("FORK", "Can't to open /dev/null " "in O_WRONLY O_TRUNC"); return false; } if (dup2(fd, 1) < 0) { - LOG_ERROR("FORK", "%s", "Failed to duplicate " + LOG_ERROR("FORK", "Failed to duplicate " "/dev/null to stdout"); return false; } @@ -158,7 +158,7 @@ metadata_from_path(char *const mkvfile, struct kara_metadata *meta) "(.+) - (OP|ED|IS|AMV|VOCA|PV|MV|LIVE)([[:digit:]]*) - (.+)\\.mkv$"; if (!regex_init && regcomp(®ex, rgx, REG_EXTENDED)) { - LOG_ERROR("MPV", "%s", "Failed to compile regex"); + LOG_ERROR("MPV", "Failed to compile regex"); goto error; } diff --git a/src/module/module_repo.c b/src/module/module_repo.c index 94e6d9c0f75ca53a097f168bb3cc76b7a03c9d18..db590b0ea54ec19337c1e8fbc6ddfff8ac207236 100644 --- a/src/module/module_repo.c +++ b/src/module/module_repo.c @@ -239,7 +239,7 @@ module_repo_new(struct module_repo_internal *repo_, struct queue *queue, volatil if (worker_pool_new(&repo.workers, 10 /* Initial number of elements in the call queue */, workers_count /* Number of worker threads */)) { - LOG_ERROR("REPO", "%s", "Out of memory"); + LOG_ERROR("REPO", "Out of memory"); return 1; } @@ -272,7 +272,7 @@ mod_new(va_list *va) if (!*repo) *repo = malloc(sizeof(struct module_repo_internal)); if (!*repo) { - LOG_ERROR("REPO", "%s", "Out of memory"); + LOG_ERROR("REPO", "Out of memory"); return 1; } @@ -314,19 +314,19 @@ mod_update(va_list *va) repo = (struct module_repo_internal **) va_arg(copy, void **); if ((*repo)->updating) { - LOG_WARN("REPO", "%s", "Already updating"); + LOG_WARN("REPO", "Already updating"); va_end(copy); return 0; } (*repo)->updating = 1; if (worker_pool_push(&(*repo)->workers, __worker_update, (void *) *repo)) { - LOG_ERROR("REPO", "%s", "Out of memory"); + LOG_ERROR("REPO", "Out of memory"); va_end(copy); return 1; } va_end(copy); - LOG_INFO("REPO", "%s", "Update started"); + LOG_INFO("REPO", "Update started"); return 0; } diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c index aff0571474dd09f77bf9078096569155936cbbe0..1f007b097ba89a53c5f6066fd88a04e2945d2308 100644 --- a/src/module/module_sdl2.c +++ b/src/module/module_sdl2.c @@ -110,7 +110,7 @@ init_mpv_gl__(mpv_handle *mpv, mpv_render_context **mpv_gl, wakeup_on_mpv_events = SDL_RegisterEvents(1); if (wakeup_on_mpv_render_update == (Uint32) - 1 || wakeup_on_mpv_events == (Uint32) - 1) { - LOG_ERROR("WINDOW", "%s", "Failed to register event"); + LOG_ERROR("WINDOW", "Failed to register event"); return 1; } @@ -306,7 +306,7 @@ sdl_thread__(struct poller_thread_arg *arg) while (!sdl2->launched) sched_yield(); - LOG_INFO("WINDOW", "%s", "Started SDL thread"); + LOG_INFO("WINDOW", "Started SDL thread"); loop: SDL_WaitEvent(&event); @@ -435,7 +435,7 @@ module_sdl2_new(struct module_sdl2_window **win, struct queue *queue, RETURN_IF(poller_new(&(*win)->self, sdl_thread__, arg), "Failed to launch the SDL thread", false); } else - LOG_DEBUG("WINDOW", "%s", "SDL window already created"); + LOG_DEBUG("WINDOW", "SDL window already created"); /* Finish */ SDL_SetWindowTitle((SDL_Window *) (*win)->window, "Lektord"); diff --git a/src/module/mpv.c b/src/module/mpv.c index e1bc032968519755b1b799e504e65a3cab2715b5..41ef21ce5b10ccdd459bc0883d86ff42eeb3bdd3 100644 --- a/src/module/mpv.c +++ b/src/module/mpv.c @@ -25,7 +25,7 @@ lmpv_free(mpv_handle **ctx) mpv_command(*ctx, cmd); mpv_destroy(*ctx); *ctx = NULL; - LOG_INFO("WINDOW", "%s", "The mpv context was destroyed"); + LOG_INFO("WINDOW", "The mpv context was destroyed"); } mpv_handle * @@ -44,7 +44,7 @@ lmpv_prepare(volatile sqlite3 *db) } #define MPV_SET_FROM_INI(opt, section, key) \ if (!database_config_get_text(db, section, key, _opt, INI_MAX_LINE_LEN)) { \ - LOG_WARN("WINDOW", "%s", "Failed to get option " \ + LOG_WARN("WINDOW", "Failed to get option " \ key " in section " section); \ return ctx; \ } \ @@ -91,11 +91,11 @@ lmpv_new(unsigned long int wid, volatile sqlite3 *db) } if (!lmpv_observe_properties(ctx)) { - LOG_ERROR("WINDOW", "%s", "Failed to observe properties"); + LOG_ERROR("WINDOW", "Failed to observe properties"); goto error; } - LOG_INFO("WINDOW", "%s", "Create mpv context"); + LOG_INFO("WINDOW", "Create mpv context"); return ctx; error: lmpv_free(&ctx); diff --git a/src/module/repo.c b/src/module/repo.c index ba77cd3401d367289eb32c3e97cdca861028c785..9ff55220bc551e234c50a3fa461693fa7fe62c9a 100644 --- a/src/module/repo.c +++ b/src/module/repo.c @@ -318,7 +318,7 @@ repo_download_id_sync(struct lkt_repo *const repo, const uint64_t id, char url[URL_MAX_LEN]; if (repo_get_id(repo, id, mdt_ret ? mdt_ret : &mdt)) { - LOG_ERROR("REPO", "%s", "Failed to get kara metadata from kurisu"); + LOG_ERROR("REPO", "Failed to get kara metadata from kurisu"); return 1; } @@ -333,7 +333,7 @@ repo_download_id_sync(struct lkt_repo *const repo, const uint64_t id, if (repo->db && !database_update_add((sqlite3 *) repo->db, kara_path, mdt_ret ? mdt_ret : &mdt, id, true)) { - LOG_ERROR("REPO", "%s", "Failed to add kara to database"); + LOG_ERROR("REPO", "Failed to add kara to database"); return 1; } @@ -487,10 +487,10 @@ __repo_get_all_id_async(void *arg) repo->name, repo->get_all_json, repo->kara_dir); __json_sync(repo, &json); __handle_got_json(repo->db, repo, json); - LOG_INFO("REPO", "%s", "Finished to download and insert kara list"); + LOG_INFO("REPO", "Finished to download and insert kara list"); json_object_put(json); __handle_deleted_kara(repo->db); - LOG_INFO("REPO", "%s", "Finished to deal with deleted kara"); + LOG_INFO("REPO", "Finished to deal with deleted kara"); database_updated(repo->db); return NULL; } diff --git a/src/module/worker.c b/src/module/worker.c index 8d4198ed208f899a0447d916b358c35a5d2178d0..3cdbf4fa143bd03aef0a6dddc5304d4437148b8f 100644 --- a/src/module/worker.c +++ b/src/module/worker.c @@ -28,7 +28,7 @@ __worker_thread(void *__pool) else if (pool->exit) { pthread_mutex_unlock(&pool->lock); - LOG_INFO("WORKER", "%s", "Exiting"); + LOG_INFO("WORKER", "Exiting"); break; } else @@ -67,7 +67,7 @@ worker_pool_new(struct worker_pool *ret, size_t init_size, size_t thread_count) .exit = 0, }; if (!__ret.functions || !__ret.args || !__ret.threads) { - LOG_ERROR("WORKER", "%s", "Out of memory"); + LOG_ERROR("WORKER", "Out of memory"); __ret.thread_size = 0u; worker_pool_free(&__ret); return 1; @@ -107,14 +107,14 @@ worker_pool_push(struct worker_pool *pool, worker_function func, void *arg) void *new_functions = realloc((void *) pool->functions, 2 * pool->size * sizeof(worker_function)); if (NULL == new_functions) { - LOG_ERROR("WORKER", "%s", "Out of memory"); + LOG_ERROR("WORKER", "Out of memory"); goto error; } void *new_args = realloc((void *) pool->args, 2 * pool->size * sizeof(void *)); if (NULL == new_args) { free(new_functions); - LOG_ERROR("WORKER", "%s", "Out of memory"); + LOG_ERROR("WORKER", "Out of memory"); goto error; } pool->size *= 2;