Skip to content

Commit 7006162

Browse files
committed
Chore: adds FF_A_COLD
1 parent 5cd4316 commit 7006162

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/common/attributes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
#define FF_A_PACKED __attribute__((__packed__))
1818
#define FF_A_WEAK_IMPORT __attribute__((__weak_import__))
1919
#define FF_A_ALWAYS_INLINE __attribute__((__always_inline__))
20+
#define FF_A_COLD __attribute__((__cold__))

src/fastfetch.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <ctype.h>
1616
#include <string.h>
1717

18+
FF_A_COLD
1819
static void printCommandFormatHelpJson(void) {
1920
yyjson_mut_doc* doc = yyjson_mut_doc_new(NULL);
2021
yyjson_mut_val* root = yyjson_mut_obj(doc);
@@ -49,6 +50,7 @@ static void printCommandFormatHelpJson(void) {
4950
yyjson_mut_doc_free(doc);
5051
}
5152

53+
FF_A_COLD
5254
static void printCommandFormatHelp(const char* command) {
5355
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS((uint32_t) (strlen(command) - strlen("-format")), command);
5456
ffStrbufLowerCase(&type);
@@ -85,6 +87,7 @@ static void printCommandFormatHelp(const char* command) {
8587
fprintf(stderr, "Error: Module '%s' is not supported\n", type.chars);
8688
}
8789

90+
FF_A_COLD
8891
static void printFullHelp() {
8992
fputs("Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way\n\n", stdout);
9093
if (!instance.config.display.pipe) {
@@ -191,6 +194,7 @@ For detailed information on logo options, module configuration, and formatting,
191194
https://github.com/fastfetch-cli/fastfetch/wiki/Configuration");
192195
}
193196

197+
FF_A_COLD
194198
static bool printSpecificCommandHelp(const char* command) {
195199
yyjson_doc* doc = yyjson_read(FASTFETCH_DATATEXT_JSON_HELP, strlen(FASTFETCH_DATATEXT_JSON_HELP), YYJSON_READ_NOFLAG);
196200
assert(doc);
@@ -301,6 +305,7 @@ static bool printSpecificCommandHelp(const char* command) {
301305
return false;
302306
}
303307

308+
FF_A_COLD
304309
static void printCommandHelp(const char* command) {
305310
if (command == NULL) {
306311
printFullHelp();
@@ -313,6 +318,7 @@ static void printCommandHelp(const char* command) {
313318
}
314319
}
315320

321+
FF_A_COLD
316322
static void listAvailablePresets(bool pretty) {
317323
FF_LIST_FOR_EACH (FFstrbuf, path, instance.state.platform.dataDirs) {
318324
ffStrbufAppendS(path, "fastfetch/presets/");
@@ -327,13 +333,15 @@ static void listAvailablePresets(bool pretty) {
327333
}
328334
}
329335

336+
FF_A_COLD
330337
static void listAvailableLogos(void) {
331338
FF_LIST_FOR_EACH (FFstrbuf, path, instance.state.platform.dataDirs) {
332339
ffStrbufAppendS(path, "fastfetch/logos/");
333340
ffListFilesRecursively(path->chars, true);
334341
}
335342
}
336343

344+
FF_A_COLD
337345
static void listConfigPaths(void) {
338346
FF_LIST_FOR_EACH (FFstrbuf, folder, instance.state.platform.configDirs) {
339347
bool exists = false;
@@ -345,13 +353,15 @@ static void listConfigPaths(void) {
345353
}
346354
}
347355

356+
FF_A_COLD
348357
static void listDataPaths(void) {
349358
FF_LIST_FOR_EACH (FFstrbuf, folder, instance.state.platform.dataDirs) {
350359
ffStrbufAppendS(folder, "fastfetch/");
351360
puts(folder->chars);
352361
}
353362
}
354363

364+
FF_A_COLD
355365
static void listModules(bool pretty) {
356366
unsigned count = 0;
357367
for (int i = 0; i <= 'Z' - 'A'; ++i) {
@@ -415,6 +425,7 @@ static bool parseJsoncFile(FFdata* data, const char* path, yyjson_read_flag flg)
415425
return true;
416426
}
417427

428+
FF_A_COLD
418429
static void generateConfigFile(FFdata* data, bool force, const char* filePath, bool fullConfig) {
419430
if (data->resultDoc) {
420431
fprintf(stderr, "Error: duplicated `--gen-config` or `--format json` flags found\n");
@@ -552,6 +563,7 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
552563
exit(414);
553564
}
554565

566+
FF_A_COLD
555567
static void printVersion() {
556568
FFVersionResult* result = &ffVersionResult;
557569
printf("%s %s%s%s (%s)\n", result->projectName, result->version, result->versionTweak, result->debugMode ? "-debug" : "", result->architecture);
@@ -572,8 +584,7 @@ static void parseCommand(FFdata* data, char* key, char* value) {
572584
if (ffStrEqualsIgnCase(key, "-h") || ffStrEqualsIgnCase(key, "--help")) {
573585
printCommandHelp(value);
574586
exit(0);
575-
}
576-
if (ffStrEqualsIgnCase(key, "--help-raw")) {
587+
} else if (ffStrEqualsIgnCase(key, "--help-raw")) {
577588
puts(FASTFETCH_DATATEXT_JSON_HELP);
578589
exit(0);
579590
} else if (ffStrEqualsIgnCase(key, "-v") || ffStrEqualsIgnCase(key, "--version")) {
@@ -792,6 +803,7 @@ static void run(FFdata* data) {
792803
}
793804
}
794805

806+
FF_A_COLD
795807
static void writeConfigFile(FFdata* data) {
796808
const FFstrbuf* filename = &data->genConfigPath;
797809

0 commit comments

Comments
 (0)