@@ -398,20 +398,107 @@ void ffFinish(FFinstance* instance)
398398 resetConsole ();
399399}
400400
401- void ffDestroyInstance ( FFinstance * instance )
401+ static void destroyModuleArg ( FFModuleArgs * args )
402402{
403- for (uint32_t i = 0 ; i < instance -> state .configDirs .length ; ++ i )
404- ffStrbufDestroy ((FFstrbuf * )ffListGet (& instance -> state .configDirs , i ));
405- ffListDestroy (& instance -> state .configDirs );
406-
407- ffStrbufDestroy (& instance -> state .cacheDir );
403+ ffStrbufDestroy (& args -> key );
404+ ffStrbufDestroy (& args -> outputFormat );
405+ ffStrbufDestroy (& args -> errorFormat );
406+ }
408407
408+ static void destroyConfig (FFinstance * instance )
409+ {
410+ ffStrbufDestroy (& instance -> config .logo .source );
409411 for (uint8_t i = 0 ; i < (uint8_t ) FASTFETCH_LOGO_MAX_COLORS ; ++ i )
410412 ffStrbufDestroy (& instance -> config .logo .colors [i ]);
411-
412413 ffStrbufDestroy (& instance -> config .colorKeys );
413414 ffStrbufDestroy (& instance -> config .colorTitle );
414415 ffStrbufDestroy (& instance -> config .separator );
416+
417+ destroyModuleArg (& instance -> config .os );
418+ destroyModuleArg (& instance -> config .host );
419+ destroyModuleArg (& instance -> config .kernel );
420+ destroyModuleArg (& instance -> config .uptime );
421+ destroyModuleArg (& instance -> config .processes );
422+ destroyModuleArg (& instance -> config .packages );
423+ destroyModuleArg (& instance -> config .shell );
424+ destroyModuleArg (& instance -> config .resolution );
425+ destroyModuleArg (& instance -> config .de );
426+ destroyModuleArg (& instance -> config .wm );
427+ destroyModuleArg (& instance -> config .wmTheme );
428+ destroyModuleArg (& instance -> config .theme );
429+ destroyModuleArg (& instance -> config .icons );
430+ destroyModuleArg (& instance -> config .font );
431+ destroyModuleArg (& instance -> config .cursor );
432+ destroyModuleArg (& instance -> config .terminal );
433+ destroyModuleArg (& instance -> config .terminalFont );
434+ destroyModuleArg (& instance -> config .cpu );
435+ destroyModuleArg (& instance -> config .cpuUsage );
436+ destroyModuleArg (& instance -> config .gpu );
437+ destroyModuleArg (& instance -> config .memory );
438+ destroyModuleArg (& instance -> config .swap );
439+ destroyModuleArg (& instance -> config .disk );
440+ destroyModuleArg (& instance -> config .battery );
441+ destroyModuleArg (& instance -> config .powerAdapter );
442+ destroyModuleArg (& instance -> config .locale );
443+ destroyModuleArg (& instance -> config .localIP );
444+ destroyModuleArg (& instance -> config .publicIP );
445+ destroyModuleArg (& instance -> config .weather );
446+ destroyModuleArg (& instance -> config .player );
447+ destroyModuleArg (& instance -> config .song );
448+ destroyModuleArg (& instance -> config .dateTime );
449+ destroyModuleArg (& instance -> config .date );
450+ destroyModuleArg (& instance -> config .time );
451+ destroyModuleArg (& instance -> config .vulkan );
452+ destroyModuleArg (& instance -> config .openGL );
453+ destroyModuleArg (& instance -> config .openCL );
454+ destroyModuleArg (& instance -> config .users );
455+
456+ ffStrbufDestroy (& instance -> config .libPCI );
457+ ffStrbufDestroy (& instance -> config .libVulkan );
458+ ffStrbufDestroy (& instance -> config .libWayland );
459+ ffStrbufDestroy (& instance -> config .libXcbRandr );
460+ ffStrbufDestroy (& instance -> config .libXcb );
461+ ffStrbufDestroy (& instance -> config .libXrandr );
462+ ffStrbufDestroy (& instance -> config .libX11 );
463+ ffStrbufDestroy (& instance -> config .libGIO );
464+ ffStrbufDestroy (& instance -> config .libDConf );
465+ ffStrbufDestroy (& instance -> config .libDBus );
466+ ffStrbufDestroy (& instance -> config .libXFConf );
467+ ffStrbufDestroy (& instance -> config .libSQLite3 );
468+ ffStrbufDestroy (& instance -> config .librpm );
469+ ffStrbufDestroy (& instance -> config .libImageMagick );
470+ ffStrbufDestroy (& instance -> config .libZ );
471+ ffStrbufDestroy (& instance -> config .libChafa );
472+ ffStrbufDestroy (& instance -> config .libEGL );
473+ ffStrbufDestroy (& instance -> config .libGLX );
474+ ffStrbufDestroy (& instance -> config .libOSMesa );
475+ ffStrbufDestroy (& instance -> config .libOpenCL );
476+ ffStrbufDestroy (& instance -> config .libcJSON );
477+ ffStrbufDestroy (& instance -> config .libfreetype );
478+
479+ ffStrbufDestroy (& instance -> config .diskFolders );
480+ ffStrbufDestroy (& instance -> config .batteryDir );
481+ ffStrbufDestroy (& instance -> config .separatorString );
482+ ffStrbufDestroy (& instance -> config .localIpNamePrefix );
483+ ffStrbufDestroy (& instance -> config .publicIpUrl );
484+ ffStrbufDestroy (& instance -> config .weatherOutputFormat );
485+ ffStrbufDestroy (& instance -> config .osFile );
486+ ffStrbufDestroy (& instance -> config .playerName );
487+ }
488+
489+ static void destroyState (FFinstance * instance )
490+ {
491+ for (uint32_t i = 0 ; i < instance -> state .configDirs .length ; ++ i )
492+ ffStrbufDestroy ((FFstrbuf * )ffListGet (& instance -> state .configDirs , i ));
493+ ffListDestroy (& instance -> state .configDirs );
494+
495+ ffStrbufDestroy (& instance -> state .cacheDir );
496+ }
497+
498+ void ffDestroyInstance (FFinstance * instance )
499+ {
500+ destroyConfig (instance );
501+ destroyState (instance );
415502}
416503
417504//Must be in a file compiled with the libfastfetch target, because the FF_HAVE* macros are not defined for the executable targets
0 commit comments