From 7a15dee2be84f9390fd14c1e2d6854f03b9acd1b Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Tue, 26 Jul 2022 17:33:51 +0200 Subject: [PATCH] Refactor: move os detection to own header --- src/detection/os.c | 1 + src/detection/os.h | 26 ++++++++++++++++++++++++++ src/fastfetch.h | 18 ------------------ src/logo/logo.c | 1 + src/modules/os.c | 1 + src/modules/packages.c | 1 + 6 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 src/detection/os.h diff --git a/src/detection/os.c b/src/detection/os.c index d0671f546..8465fce8a 100644 --- a/src/detection/os.c +++ b/src/detection/os.c @@ -1,4 +1,5 @@ #include "fastfetch.h" +#include "detection/os.h" #include "common/properties.h" #include "common/parsing.h" diff --git a/src/detection/os.h b/src/detection/os.h new file mode 100644 index 000000000..d78695b5f --- /dev/null +++ b/src/detection/os.h @@ -0,0 +1,26 @@ +#pragma once + +#ifndef FF_INCLUDED_detection_os +#define FF_INCLUDED_detection_os + +#include "util/FFstrbuf.h" + +typedef struct FFOSResult +{ + FFstrbuf systemName; + FFstrbuf name; + FFstrbuf prettyName; + FFstrbuf id; + FFstrbuf idLike; + FFstrbuf variant; + FFstrbuf variantID; + FFstrbuf version; + FFstrbuf versionID; + FFstrbuf codename; + FFstrbuf buildID; + FFstrbuf architecture; +} FFOSResult; + +const FFOSResult* ffDetectOS(const FFinstance* instance); + +#endif diff --git a/src/fastfetch.h b/src/fastfetch.h index 7625f474d..e2711d78e 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -173,22 +173,6 @@ typedef struct FFinstance FFstate state; } FFinstance; -typedef struct FFOSResult -{ - FFstrbuf systemName; - FFstrbuf name; - FFstrbuf prettyName; - FFstrbuf id; - FFstrbuf idLike; - FFstrbuf variant; - FFstrbuf variantID; - FFstrbuf version; - FFstrbuf versionID; - FFstrbuf codename; - FFstrbuf buildID; - FFstrbuf architecture; -} FFOSResult; - typedef struct FFQtResult { FFstrbuf widgetStyle; @@ -329,8 +313,6 @@ void ffLogoBuiltinListAutocompletion(); ///////////////////////// // Detection functions // ///////////////////////// -//detection/os.c -const FFOSResult* ffDetectOS(const FFinstance* instance); //detection/plasma.c const FFQtResult* ffDetectQt(FFinstance* instance); diff --git a/src/logo/logo.c b/src/logo/logo.c index 6cda62028..608e506da 100644 --- a/src/logo/logo.c +++ b/src/logo/logo.c @@ -1,6 +1,7 @@ #include "logo.h" #include "common/io.h" #include "common/printing.h" +#include "detection/os.h" #include #include diff --git a/src/modules/os.c b/src/modules/os.c index 2d6703878..91809a59f 100644 --- a/src/modules/os.c +++ b/src/modules/os.c @@ -1,5 +1,6 @@ #include "fastfetch.h" #include "common/printing.h" +#include "detection/os.h" #include diff --git a/src/modules/packages.c b/src/modules/packages.c index 5b71380c4..8c1021d1a 100644 --- a/src/modules/packages.c +++ b/src/modules/packages.c @@ -4,6 +4,7 @@ #include "common/printing.h" #include "common/settings.h" #include "common/processing.h" +#include "detection/os.h" #include #include