File tree Expand file tree Collapse file tree 3 files changed +4
-6
lines changed
Expand file tree Collapse file tree 3 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 2222#include <string.h>
2323
2424int main (int argc , char * argv []) {
25- FetchStat * stats ;
25+ FetchStat stats [ STATS_SIZE ] ;
2626 bool ok = parse_args (argc , argv );
2727 const char * label ;
2828 int label_len ;
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
4040 return 0 ;
4141 }
4242
43- stats = get_stats ();
43+ get_stats (stats );
4444 for (int line_index = 0 ; line_index < ART_HEIGHT || line_index < STATS_SIZE ;
4545 line_index ++ ) {
4646 if (line_index < ART_HEIGHT ) {
Original file line number Diff line number Diff line change @@ -120,8 +120,7 @@ char *screenfetch() {
120120 return extract_named_version (out , "[4mscreenFetch[0m - Version " );
121121}
122122
123- FetchStat * get_stats () {
124- FetchStat * stats = malloc (STATS_SIZE * sizeof (FetchStat ));
123+ void get_stats (FetchStat stats [STATS_SIZE ]) {
125124 stats [0 ].label = "Fastfetch" ;
126125 stats [0 ].version = fastfetch ();
127126 stats [1 ].label = "fetchfetch" ;
@@ -136,5 +135,4 @@ FetchStat *get_stats() {
136135 stats [5 ].version = uwufetch ();
137136 stats [6 ].label = "screenFetch" ;
138137 stats [6 ].version = screenfetch ();
139- return stats ;
140138}
Original file line number Diff line number Diff line change @@ -55,6 +55,6 @@ char *screenfetch();
5555/**
5656 * Gets all stats.
5757 */
58- FetchStat * get_stats ();
58+ void get_stats (FetchStat stats [ STATS_SIZE ] );
5959
6060#endif
You can’t perform that action at this time.
0 commit comments