@@ -131,54 +131,6 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
131131 }
132132}
133133
134- static void printMountpoint (FFDiskOptions * options , const FFlist * disks , const char * mountpoint )
135- {
136- FF_LIST_FOR_EACH (FFDisk , disk , * disks )
137- {
138- if (ffStrbufEqualS (& disk -> mountpoint , mountpoint ))
139- {
140- printDisk (options , disk );
141- return ;
142- }
143- }
144-
145- ffPrintError (FF_DISK_MODULE_NAME , 0 , & options -> moduleArgs , FF_PRINT_TYPE_DEFAULT , "No disk found for mountpoint: %s" , mountpoint );
146- }
147-
148- static void printMountpoints (FFDiskOptions * options , const FFlist * disks )
149- {
150- #ifdef _WIN32
151- const char separator = ';' ;
152- #else
153- const char separator = ':' ;
154- #endif
155-
156- FF_STRBUF_AUTO_DESTROY mountpoints = ffStrbufCreateCopy (& options -> folders );
157- ffStrbufTrim (& mountpoints , separator );
158-
159- uint32_t startIndex = 0 ;
160- while (startIndex < mountpoints .length )
161- {
162- uint32_t colonIndex = ffStrbufNextIndexC (& mountpoints , startIndex , separator );
163- mountpoints .chars [colonIndex ] = '\0' ;
164-
165- printMountpoint (options , disks , mountpoints .chars + startIndex );
166-
167- startIndex = colonIndex + 1 ;
168- }
169- }
170-
171- static void printAutodetected (FFDiskOptions * options , const FFlist * disks )
172- {
173- FF_LIST_FOR_EACH (FFDisk , disk , * disks )
174- {
175- if (disk -> type & ~options -> showTypes )
176- continue ;
177-
178- printDisk (options , disk );
179- }
180- }
181-
182134void ffPrintDisk (FFDiskOptions * options )
183135{
184136 FF_LIST_AUTO_DESTROY disks = ffListCreate (sizeof (FFDisk ));
@@ -190,10 +142,13 @@ void ffPrintDisk(FFDiskOptions* options)
190142 }
191143 else
192144 {
193- if (options -> folders .length == 0 )
194- printAutodetected (options , & disks );
195- else
196- printMountpoints (options , & disks );
145+ FF_LIST_FOR_EACH (FFDisk , disk , disks )
146+ {
147+ if (__builtin_expect (options -> folders .length == 0 , 1 ) && (disk -> type & ~options -> showTypes ))
148+ continue ;
149+
150+ printDisk (options , disk );
151+ }
197152 }
198153
199154 FF_LIST_FOR_EACH (FFDisk , disk , disks )
0 commit comments