Refactor: move parsing functions to own header

This commit is contained in:
Linus Dierheimer
2022-07-25 13:59:19 +02:00
parent 5c73125693
commit c41a29a5c1
19 changed files with 42 additions and 16 deletions
+1
View File
@@ -1,4 +1,5 @@
#include "fastfetch.h"
#include "common/parsing.h"
bool ffStrSet(const char* str)
{
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#ifndef FF_INCLUDED_parsing_h
#define FF_INCLUDED_parsing_h
#include <stdint.h>
typedef struct FFVersion
{
uint32_t major;
uint32_t minor;
uint32_t patch;
} FFVersion;
#define FF_VERSION_INIT ((FFVersion) {0})
bool ffStrSet(const char* str);
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4);
void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
#endif
+2
View File
@@ -3,6 +3,8 @@
#ifndef FF_INCLUDED_common_properties
#define FF_INCLUDED_common_properties
#include "util/FFstrbuf.h"
typedef struct FFpropquery
{
const char* start;
+1
View File
@@ -1,6 +1,7 @@
#include "displayServer.h"
#include "common/io.h"
#include "common/properties.h"
#include "common/parsing.h"
#include <stdlib.h>
#include <ctype.h>
+1
View File
@@ -2,6 +2,7 @@
#ifdef FF_HAVE_X11
#include "common/library.h"
#include "common/parsing.h"
#include <X11/Xlib.h>
typedef struct X11PropertyData
+1
View File
@@ -8,6 +8,7 @@
#ifdef FF_HAVE_DBUS
#include "common/library.h"
#include "common/parsing.h"
#include <dbus/dbus.h>
#define FF_DBUS_ITER_CONTINUE(iterator) \
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/properties.h"
#include "common/parsing.h"
#include <string.h>
#include <stdlib.h>
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/io.h"
#include "common/parsing.h"
#include <ctype.h>
#include <string.h>
+1
View File
@@ -5,6 +5,7 @@
#ifdef FF_HAVE_VULKAN
#include "common/library.h"
#include "common/io.h"
#include "common/parsing.h"
#include <stdlib.h>
#include <vulkan/vulkan.h>
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "common/parsing.h"
#include <stdlib.h>
#include <string.h>
-16
View File
@@ -173,14 +173,6 @@ typedef struct FFinstance
FFstate state;
} FFinstance;
typedef struct FFVersion
{
uint32_t major;
uint32_t minor;
uint32_t patch;
} FFVersion;
#define FF_VERSION_INIT ((FFVersion) {0})
typedef struct FFTitleResult
{
FFstrbuf userName;
@@ -375,14 +367,6 @@ void ffStartDetectionThreads(FFinstance* instance);
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
//common/parsing.c
bool ffStrSet(const char* str);
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4);
void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
//common/processing.c
void ffProcessAppendStdOut(FFstrbuf* buffer, char* const argv[]);
+1
View File
@@ -1,6 +1,7 @@
#include "fastfetch.h"
#include "common/properties.h"
#include "common/printing.h"
#include "common/parsing.h"
#include <stdlib.h>
+1
View File
@@ -1,6 +1,7 @@
#include "fastfetch.h"
#include "common/font.h"
#include "common/printing.h"
#include "common/parsing.h"
#define FF_FONT_MODULE_NAME "Font"
#define FF_FONT_NUM_FORMAT_ARGS 21
+1
View File
@@ -1,6 +1,7 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "common/caching.h"
#include "common/parsing.h"
#include <stdlib.h>
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "common/parsing.h"
#define FF_ICONS_MODULE_NAME "Icons"
#define FF_ICONS_NUM_FORMAT_ARGS 5
+1
View File
@@ -6,6 +6,7 @@
#ifdef FF_HAVE_OPENCL
#include "common/library.h"
#include "common/parsing.h"
#define CL_TARGET_OPENCL_VERSION 100
#include <CL/cl.h>
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "common/parsing.h"
#include <string.h>
+1
View File
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "common/parsing.h"
#define FF_THEME_MODULE_NAME "Theme"
#define FF_THEME_NUM_FORMAT_ARGS 7
+1
View File
@@ -1,6 +1,7 @@
#include "fastfetch.h"
#include "common/properties.h"
#include "common/printing.h"
#include "common/parsing.h"
#include <stdlib.h>
#include <string.h>