From f1125b0017a727b522ef43b086e7d0256e9f1a9d Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Sat, 2 May 2020 10:53:08 +0200 Subject: [PATCH] Less header files, regroup things --- inc/common/common.h | 22 +++++++ inc/common/macro.h | 109 +++++++++++++++++++++++++++++++++ inc/lektor/bufferfd.h | 2 +- inc/lektor/commands.h | 2 +- inc/lektor/common.h | 132 ---------------------------------------- inc/lektor/config.h | 2 +- inc/lektor/database.h | 2 +- inc/lektor/mkv.h | 2 +- inc/lektor/module/mpv.h | 2 +- inc/lektor/net.h | 2 +- inc/lektor/thread.h | 2 +- inc/lektor/uri.h | 1 - inc/lektor/window.h | 2 +- src/cmd.c | 2 +- src/commands.c | 1 - src/common.c | 2 + src/config.c | 1 - src/database/config.c | 2 +- src/database/find.c | 2 +- src/database/open.c | 2 +- src/database/playlist.c | 1 - src/database/queue.c | 2 +- src/database/stickers.c | 2 +- src/database/update.c | 1 - src/database/user.c | 2 +- src/main/lkt.c | 1 + src/main/lktadm.c | 1 - src/main/server.c | 1 + src/mkv/mkv.c | 4 +- src/module/module_x11.c | 1 - src/module/mpv.c | 1 - src/net/downloader.c | 1 - src/net/listen.c | 1 - src/net/message.c | 3 +- src/uri.c | 3 + 35 files changed, 159 insertions(+), 160 deletions(-) delete mode 100644 inc/lektor/common.h diff --git a/inc/common/common.h b/inc/common/common.h index 47ec6651..1b930726 100644 --- a/inc/common/common.h +++ b/inc/common/common.h @@ -2,6 +2,7 @@ #include <common/macro.h> #include <unistd.h> +#include <stdint.h> #define not_implemented() __not_implemented(__func__,__FILE__,__LINE__) extern void __not_implemented(const char *func, char *file, int line); @@ -12,3 +13,24 @@ void __unused(void *, ...); long get_mtime(const char *path); void *safe_malloc(size_t size); + +int is_utf8(const char *string); + +/* Read `bytes` as the big endian representation of a 32-bit unsigned integer. + `n` is the number of bytes in `bytes` + Returns 0 if n is 0. + Restriction: n <= 4 */ +uint32_t be_uint32_t(const uint8_t bytes[], size_t n); + +/* Same as `be_uint32_t` but for 64-bit unsigned integers. + Restriction: n <= 8 */ +uint64_t be_uint64_t(const uint8_t bytes[], size_t n); + +/* Trim the string `str` of the char `c` from the right and the left. + The string may not be null terminated. + Returns a pointer to the the trimmed string + Restrictions: the len of the string must be `len`. */ +char *trim(char *str, size_t len, char c); + +/* Get a line from stdin safely. */ +int get_stdin_line(const char *prompt, char *buf, size_t len); diff --git a/inc/common/macro.h b/inc/common/macro.h index be074b7b..cc89cf24 100644 --- a/inc/common/macro.h +++ b/inc/common/macro.h @@ -1,5 +1,8 @@ #pragma once +#include <stdint.h> +#include <stdlib.h> + /* Max value for any buffer, to not squash the stack. */ #define BUFFER_MAX 4096 @@ -60,3 +63,109 @@ #define LOG_WARN(format, ...) LOG_WARN_SCT("", format, __VA_ARGS__) #define LOG_ERROR(format, ...) LOG_DEBUG_SCT("", format, __VA_ARGS__) #define LOG_DEBUG(format, ...) LOG_DEBUG_SCT("", format, __VA_ARGS__) + +/* Defines for lektor */ + +#define INI_MAX_LINE_LEN 512 +#define INI_MAX_SECTION_LEN 80 + +#define URL_MAX_LEN 1024 +#define DEFAULT_URL "https://kurisu.iiens.net" +#define GET_ID_JSON DEFAULT_URL "/api_karas.php?id=%ld" +#define GET_ID_FILE DEFAULT_URL "/download.php?id=%ld" + +#define SELF_EXECUTABLE_LINUX "/proc/self/exe" +#define SELF_EXECUTABLE_FREEBSD "/proc/curproc/file" +#define SELF_EXECUTABLE_SOLARIS "/proc/self/path/a.out" + + +#define LKT_MAX_SQLITE_STATEMENT 1024 +#define PROTECTED_DATABASE "disk" + +#define LKT_DATABASE_NAME_KID "id" +#define LKT_DATABASE_NAME_KNAME "source_name" +#define LKT_DATABASE_NAME_KTITLE "song_title" +#define LKT_DATABASE_NAME_KCAT "category" +#define LKT_DATABASE_NAME_KTYPE "song_type" +#define LKT_DATABASE_NAME_KAUTHOR "author_name" +#define LKT_DATABASE_NAME_KAUTHOR_YEAR "author_year" +#define LKT_DATABASE_NAME_KLANG "language" +#define LKT_DATABASE_KARA_COLUMNT_ANY "any_col" +#define LKT_DATABASE_KARA_ALL "string" + +#define LEKTOR_TAG_MAX 256 +#define LKT_MESSAGE_ARGS_MAX 32 +#define LKT_MESSAGE_MAX 2048 +#define LKT_DEFAULT_LIST_SIZE 10 + +typedef volatile enum { + MPD_IDLE_NONE = 0, + + MPD_IDLE_DATABASE = ( 1 << 1 ), + MPD_IDLE_UPDATE = ( 1 << 2 ), + MPD_IDLE_STORED_PLAYLIST = ( 1 << 3 ), + MPD_IDLE_PLAYLIST = ( 1 << 4 ), + MPD_IDLE_PLAYER = ( 1 << 5 ), + MPD_IDLE_MIXER = ( 1 << 6 ), + MPD_IDLE_OUTPUT = ( 1 << 7 ), + MPD_IDLE_OPTIONS = ( 1 << 8 ), + MPD_IDLE_PARTITION = ( 1 << 9 ), + MPD_IDLE_STICKER = ( 1 << 10 ), + MPD_IDLE_SUBSCRIPTION = ( 1 << 11 ), + MPD_IDLE_MESSAGE = ( 1 << 12 ), + + MPD_IDLE_ALL = + MPD_IDLE_DATABASE | MPD_IDLE_UPDATE | MPD_IDLE_STORED_PLAYLIST | + MPD_IDLE_PLAYLIST | MPD_IDLE_PLAYER | MPD_IDLE_MIXER | + MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION | + MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE, +} mpd_idle_flag; + +#define LKT_BACKLOG 32 +#define COMMAND_LIST_MAX 64 +#define BUFFER_OUT_MAX 16 +#define MPD_VERSION "0.21.16" + +/* Macros */ + +#define SQLITE_PREPARE(db, stmt, SQL, goto_label) \ + if (sqlite3_prepare_v2((sqlite3 *) db, SQL, -1, &(stmt), 0) != SQLITE_OK) { \ + LOG_ERROR_SCT("DB", "Failed to prepare statement: %s", \ + sqlite3_errmsg((sqlite3 *) db)); \ + goto goto_label; \ + } + +#define SQLITE_EXEC(db, SQL, goto_label) \ + if (sqlite3_exec((sqlite3 *) db, SQL, NULL, NULL, NULL) != SQLITE_OK) { \ + LOG_ERROR_SCT("DB", "Failed to exec statement: %s", \ + sqlite3_errmsg((sqlite3 *) db)); \ + goto goto_label; \ + } + +#define SQLITE_BIND_TEXT(db, stmt, pos, text, error) \ + if (sqlite3_bind_text(stmt, pos, text, -1, 0) != SQLITE_OK) { \ + LOG_ERROR_SCT("DB", "Failed to bind text %s at pos %d: %s", \ + text, pos, sqlite3_errmsg((sqlite3 *) db)); \ + goto error; \ + } + +#define SQLITE_BIND_INT(db, stmt, pos, integer, error) \ + if (sqlite3_bind_int(stmt, pos, integer) != SQLITE_OK) { \ + LOG_ERROR_SCT("DB", "Failed to bind int %d at pos %d: %s", \ + integer, pos, sqlite3_errmsg((sqlite3 *) db)); \ + goto error; \ + } + +#define SQLITE_STEP(db, stmt, code, error) \ + if (sqlite3_step(stmt) != code) { \ + LOG_ERROR_SCT("DB", "Failed to step: %s", \ + sqlite3_errmsg((sqlite3 *) db)); \ + goto error; \ + } + +#define SQLITE_STEP_ROW(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_ROW, error) +#define SQLITE_STEP_DONE(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_DONE, error) +#define SQLITE_STEP_OK(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_OK, error) + +#define SQLITE_DO_ROLLBACK(db) \ + sqlite3_exec((sqlite3 *) db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL); diff --git a/inc/lektor/bufferfd.h b/inc/lektor/bufferfd.h index c6e4ccbc..ffc4aacd 100644 --- a/inc/lektor/bufferfd.h +++ b/inc/lektor/bufferfd.h @@ -23,7 +23,7 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <stdint.h> #include <stdlib.h> diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h index 452d46bb..a447ef36 100644 --- a/inc/lektor/commands.h +++ b/inc/lektor/commands.h @@ -1,6 +1,6 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <lektor/net.h> #include <lektor/window.h> diff --git a/inc/lektor/common.h b/inc/lektor/common.h deleted file mode 100644 index 7b0839cb..00000000 --- a/inc/lektor/common.h +++ /dev/null @@ -1,132 +0,0 @@ -#pragma once - -#include <common/common.h> -#include <stdint.h> -#include <stdlib.h> - -/* Defines */ - -#define INI_MAX_LINE_LEN 512 -#define INI_MAX_SECTION_LEN 80 - -#define URL_MAX_LEN 1024 -#define DEFAULT_URL "https://kurisu.iiens.net" -#define GET_ID_JSON DEFAULT_URL "/api_karas.php?id=%ld" -#define GET_ID_FILE DEFAULT_URL "/download.php?id=%ld" - -#define SELF_EXECUTABLE_LINUX "/proc/self/exe" -#define SELF_EXECUTABLE_FREEBSD "/proc/curproc/file" -#define SELF_EXECUTABLE_SOLARIS "/proc/self/path/a.out" - - -#define LKT_MAX_SQLITE_STATEMENT 1024 -#define PROTECTED_DATABASE "disk" - -#define LKT_DATABASE_NAME_KID "id" -#define LKT_DATABASE_NAME_KNAME "source_name" -#define LKT_DATABASE_NAME_KTITLE "song_title" -#define LKT_DATABASE_NAME_KCAT "category" -#define LKT_DATABASE_NAME_KTYPE "song_type" -#define LKT_DATABASE_NAME_KAUTHOR "author_name" -#define LKT_DATABASE_NAME_KAUTHOR_YEAR "author_year" -#define LKT_DATABASE_NAME_KLANG "language" -#define LKT_DATABASE_KARA_COLUMNT_ANY "any_col" -#define LKT_DATABASE_KARA_ALL "string" - -#define LEKTOR_TAG_MAX 256 -#define LKT_MESSAGE_ARGS_MAX 32 -#define LKT_MESSAGE_MAX 2048 -#define LKT_DEFAULT_LIST_SIZE 10 - -typedef volatile enum { - MPD_IDLE_NONE = 0, - - MPD_IDLE_DATABASE = ( 1 << 1 ), - MPD_IDLE_UPDATE = ( 1 << 2 ), - MPD_IDLE_STORED_PLAYLIST = ( 1 << 3 ), - MPD_IDLE_PLAYLIST = ( 1 << 4 ), - MPD_IDLE_PLAYER = ( 1 << 5 ), - MPD_IDLE_MIXER = ( 1 << 6 ), - MPD_IDLE_OUTPUT = ( 1 << 7 ), - MPD_IDLE_OPTIONS = ( 1 << 8 ), - MPD_IDLE_PARTITION = ( 1 << 9 ), - MPD_IDLE_STICKER = ( 1 << 10 ), - MPD_IDLE_SUBSCRIPTION = ( 1 << 11 ), - MPD_IDLE_MESSAGE = ( 1 << 12 ), - - MPD_IDLE_ALL = - MPD_IDLE_DATABASE | MPD_IDLE_UPDATE | MPD_IDLE_STORED_PLAYLIST | - MPD_IDLE_PLAYLIST | MPD_IDLE_PLAYER | MPD_IDLE_MIXER | - MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION | - MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE, -} mpd_idle_flag; - -#define LKT_BACKLOG 32 -#define COMMAND_LIST_MAX 64 -#define BUFFER_OUT_MAX 16 -#define MPD_VERSION "0.21.16" - -/* Macros */ - -#define SQLITE_PREPARE(db, stmt, SQL, goto_label) \ - if (sqlite3_prepare_v2((sqlite3 *) db, SQL, -1, &(stmt), 0) != SQLITE_OK) { \ - LOG_ERROR_SCT("DB", "Failed to prepare statement: %s", \ - sqlite3_errmsg((sqlite3 *) db)); \ - goto goto_label; \ - } - -#define SQLITE_EXEC(db, SQL, goto_label) \ - if (sqlite3_exec((sqlite3 *) db, SQL, NULL, NULL, NULL) != SQLITE_OK) { \ - LOG_ERROR_SCT("DB", "Failed to exec statement: %s", \ - sqlite3_errmsg((sqlite3 *) db)); \ - goto goto_label; \ - } - -#define SQLITE_BIND_TEXT(db, stmt, pos, text, error) \ - if (sqlite3_bind_text(stmt, pos, text, -1, 0) != SQLITE_OK) { \ - LOG_ERROR_SCT("DB", "Failed to bind text %s at pos %d: %s", \ - text, pos, sqlite3_errmsg((sqlite3 *) db)); \ - goto error; \ - } - -#define SQLITE_BIND_INT(db, stmt, pos, integer, error) \ - if (sqlite3_bind_int(stmt, pos, integer) != SQLITE_OK) { \ - LOG_ERROR_SCT("DB", "Failed to bind int %d at pos %d: %s", \ - integer, pos, sqlite3_errmsg((sqlite3 *) db)); \ - goto error; \ - } - -#define SQLITE_STEP(db, stmt, code, error) \ - if (sqlite3_step(stmt) != code) { \ - LOG_ERROR_SCT("DB", "Failed to step: %s", \ - sqlite3_errmsg((sqlite3 *) db)); \ - goto error; \ - } - -#define SQLITE_STEP_ROW(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_ROW, error) -#define SQLITE_STEP_DONE(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_DONE, error) -#define SQLITE_STEP_OK(db, stmt, error) SQLITE_STEP(db, stmt, SQLITE_OK, error) - -#define SQLITE_DO_ROLLBACK(db) \ - sqlite3_exec((sqlite3 *) db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL); - -/* Random things */ - -/* Read `bytes` as the big endian representation of a 32-bit unsigned integer. - `n` is the number of bytes in `bytes` - Returns 0 if n is 0. - Restriction: n <= 4 */ -uint32_t be_uint32_t(const uint8_t bytes[], size_t n); - -/* Same as `be_uint32_t` but for 64-bit unsigned integers. - Restriction: n <= 8 */ -uint64_t be_uint64_t(const uint8_t bytes[], size_t n); - -/* Trim the string `str` of the char `c` from the right and the left. - The string may not be null terminated. - Returns a pointer to the the trimmed string - Restrictions: the len of the string must be `len`. */ -char *trim(char *str, size_t len, char c); - -/* Get a line from stdin safely. */ -int get_stdin_line(const char *prompt, char *buf, size_t len); diff --git a/inc/lektor/config.h b/inc/lektor/config.h index f9e91358..9affc952 100644 --- a/inc/lektor/config.h +++ b/inc/lektor/config.h @@ -1,6 +1,6 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <stddef.h> #include <sqlite3.h> diff --git a/inc/lektor/database.h b/inc/lektor/database.h index e1bffe15..1e7a7bfb 100644 --- a/inc/lektor/database.h +++ b/inc/lektor/database.h @@ -1,6 +1,6 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <lektor/mkv.h> #include <lektor/uri.h> diff --git a/inc/lektor/mkv.h b/inc/lektor/mkv.h index c8811426..21b3808c 100644 --- a/inc/lektor/mkv.h +++ b/inc/lektor/mkv.h @@ -23,7 +23,7 @@ */ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <linux/limits.h> #include <stddef.h> diff --git a/inc/lektor/module/mpv.h b/inc/lektor/module/mpv.h index a05fdaf9..db2070c4 100644 --- a/inc/lektor/module/mpv.h +++ b/inc/lektor/module/mpv.h @@ -3,7 +3,7 @@ #include <sqlite3.h> #include <mpv/client.h> #include <lektor/net.h> -#include <lektor/common.h> +#include <common/common.h> void lmpv_free(mpv_handle **ctx); mpv_handle *lmpv_new(unsigned long int wid); diff --git a/inc/lektor/net.h b/inc/lektor/net.h index fa721922..1a4e96a7 100644 --- a/inc/lektor/net.h +++ b/inc/lektor/net.h @@ -1,7 +1,7 @@ #pragma once +#include <common/common.h> #include <lektor/mkv.h> -#include <lektor/common.h> #include <lektor/config.h> #include <lektor/window.h> #include <lektor/thread.h> diff --git a/inc/lektor/thread.h b/inc/lektor/thread.h index 3e5e07a7..7a85147f 100644 --- a/inc/lektor/thread.h +++ b/inc/lektor/thread.h @@ -1,6 +1,6 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <pthread.h> #include <sys/types.h> diff --git a/inc/lektor/uri.h b/inc/lektor/uri.h index c9a4d932..b9ab5087 100644 --- a/inc/lektor/uri.h +++ b/inc/lektor/uri.h @@ -1,6 +1,5 @@ #pragma once -#include <lektor/common.h> #include <stddef.h> #include <stddef.h> #include <stdbool.h> diff --git a/inc/lektor/window.h b/inc/lektor/window.h index ab5f43b8..d61ed465 100644 --- a/inc/lektor/window.h +++ b/inc/lektor/window.h @@ -1,6 +1,6 @@ #pragma once -#include <lektor/common.h> +#include <common/common.h> #include <stdbool.h> #include <sqlite3.h> diff --git a/src/cmd.c b/src/cmd.c index 9cd2b012..b56e868e 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L #include <lektor/cmd.h> -#include <lektor/common.h> +#include <common/common.h> #include <sys/types.h> #include <stdlib.h> #include <strings.h> diff --git a/src/commands.c b/src/commands.c index cc53c0c4..7243a00b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1,7 +1,6 @@ #define _POSIX_C_SOURCE 200809L #include <common/common.h> -#include <lektor/common.h> #include <lektor/commands.h> #include <lektor/database.h> #include <lektor/net.h> diff --git a/src/common.c b/src/common.c index df21628d..95a57368 100644 --- a/src/common.c +++ b/src/common.c @@ -1,3 +1,5 @@ +#define _POSIX_C_SOURCE 200809L + #include <common/common.h> #include <stdint.h> #include <stdio.h> diff --git a/src/config.c b/src/config.c index e5a7a688..707c48ec 100644 --- a/src/config.c +++ b/src/config.c @@ -1,7 +1,6 @@ #define _POSIX_C_SOURCE 200809L #include <common/common.h> -#include <lektor/common.h> #include <lektor/config.h> #include <lektor/database.h> #include <stdlib.h> diff --git a/src/database/config.c b/src/database/config.c index c2802ffd..00c82c62 100644 --- a/src/database/config.c +++ b/src/database/config.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <limits.h> #include <stdio.h> diff --git a/src/database/find.c b/src/database/find.c index ffc4b437..61205fe9 100644 --- a/src/database/find.c +++ b/src/database/find.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <limits.h> #include <stdio.h> diff --git a/src/database/open.c b/src/database/open.c index dfc470ee..24b9fec3 100644 --- a/src/database/open.c +++ b/src/database/open.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/database/playlist.c b/src/database/playlist.c index 2079ec83..96f704f0 100644 --- a/src/database/playlist.c +++ b/src/database/playlist.c @@ -2,7 +2,6 @@ #include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <stdio.h> #include <strings.h> diff --git a/src/database/queue.c b/src/database/queue.c index 8cf4fae3..770796c6 100644 --- a/src/database/queue.c +++ b/src/database/queue.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <linux/limits.h> #include <stdio.h> diff --git a/src/database/stickers.c b/src/database/stickers.c index e2fc96ee..37662198 100644 --- a/src/database/stickers.c +++ b/src/database/stickers.c @@ -1,6 +1,6 @@ #define _POSIX_C_SOURCE 200809L -#include <lektor/common.h> +#include <common/common.h> #include <lektor/database.h> #include <string.h> #include <strings.h> diff --git a/src/database/update.c b/src/database/update.c index 80429007..cacb7bad 100644 --- a/src/database/update.c +++ b/src/database/update.c @@ -3,7 +3,6 @@ #include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <stdbool.h> #include <sqlite3.h> diff --git a/src/database/user.c b/src/database/user.c index ab347f40..cad67826 100644 --- a/src/database/user.c +++ b/src/database/user.c @@ -1,7 +1,7 @@ #define _POSIX_C_SOURCE 200809L +#include <common/common.h> #include <lektor/database.h> -#include <lektor/common.h> #include <stdio.h> bool diff --git a/src/main/lkt.c b/src/main/lkt.c index 8ea952bd..94114a94 100644 --- a/src/main/lkt.c +++ b/src/main/lkt.c @@ -3,6 +3,7 @@ #include <common/common.h> #include <lektor/net.h> #include <lektor/cmd.h> + #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> diff --git a/src/main/lktadm.c b/src/main/lktadm.c index a67d8d28..d4b25a85 100644 --- a/src/main/lktadm.c +++ b/src/main/lktadm.c @@ -8,7 +8,6 @@ #include <lektor/mkv.h> #include <lektor/database.h> #include <lektor/net.h> -#include <lektor/common.h> #include <stdio.h> #include <stdlib.h> diff --git a/src/main/server.c b/src/main/server.c index 434784e2..ad3e0959 100644 --- a/src/main/server.c +++ b/src/main/server.c @@ -5,6 +5,7 @@ #include <lektor/net.h> #include <lektor/database.h> #include <mthread/mthread.h> + #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/src/mkv/mkv.c b/src/mkv/mkv.c index 39efb961..a62d536f 100644 --- a/src/mkv/mkv.c +++ b/src/mkv/mkv.c @@ -1,3 +1,5 @@ +#define _POSIX_C_SOURCE 200809L + #include <fcntl.h> #include <stdint.h> #include <stdio.h> @@ -7,7 +9,7 @@ #include <lektor/bufferfd.h> #include <lektor/mkv.h> -#include <lektor/common.h> +#include <common/common.h> #define MKV_TAG_MAX 64 diff --git a/src/module/module_x11.c b/src/module/module_x11.c index 8fd16618..5852a9c4 100644 --- a/src/module/module_x11.c +++ b/src/module/module_x11.c @@ -2,7 +2,6 @@ #include <common/common.h> #include <lektor/module/module_x11.h> -#include <lektor/common.h> #include <lektor/module/mpv.h> #include <lektor/database.h> #include <lektor/commands.h> diff --git a/src/module/mpv.c b/src/module/mpv.c index 2fc401d0..b29d7153 100644 --- a/src/module/mpv.c +++ b/src/module/mpv.c @@ -4,7 +4,6 @@ #include <lektor/module/mpv.h> #include <lektor/commands.h> #include <lektor/database.h> -#include <lektor/common.h> #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/src/net/downloader.c b/src/net/downloader.c index 96abec51..9df9b1ba 100644 --- a/src/net/downloader.c +++ b/src/net/downloader.c @@ -12,7 +12,6 @@ #include <common/common.h> #include <mthread/mthread.h> -#include <lektor/common.h> #include <lektor/database.h> #include <lektor/net.h> diff --git a/src/net/listen.c b/src/net/listen.c index 489c5e79..4c73ff20 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -2,7 +2,6 @@ #include <common/common.h> #include <lektor/commands.h> -#include <lektor/common.h> #include <lektor/database.h> #include <lektor/net.h> diff --git a/src/net/message.c b/src/net/message.c index 16dab383..21d3bf32 100644 --- a/src/net/message.c +++ b/src/net/message.c @@ -1,5 +1,6 @@ -#include <lektor/net.h> +#define _POSIX_C_SOURCE 200809L +#include <lektor/net.h> #include <stdlib.h> struct lkt_message * diff --git a/src/uri.c b/src/uri.c index ac8634be..ec076ed2 100644 --- a/src/uri.c +++ b/src/uri.c @@ -1,3 +1,6 @@ +#define _POSIX_C_SOURCE 200809L + +#include <common/common.h> #include <lektor/uri.h> #include <stdlib.h> #include <string.h> -- GitLab