master ohmu/fastfetch-openbsd / src / common / parsing.h
ohmu  ·  2026-10-15
 1#pragma once
 2
 3#include "common/FFstrbuf.h"
 4
 5#include <stdint.h>
 6
 7typedef struct FFVersion {
 8    uint32_t major;
 9    uint32_t minor;
10    uint32_t patch;
11} FFVersion;
12
13typedef struct FFColorRangeConfig {
14    uint8_t green;
15    uint8_t yellow;
16} FFColorRangeConfig;
17
18#define FF_VERSION_INIT ((FFVersion) { 0 })
19
20// Every argument is dereferenced unconditionally
21[[gnu::nonnull(1, 2, 3, 4)]] void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
22[[gnu::nonnull(1, 2, 3, 4)]] void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4);
23
24[[gnu::nonnull(1, 2)]] void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
25[[gnu::nonnull(1, 2), gnu::pure, nodiscard]] int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);