mirror of
https://github.com/lbonn/rofi
synced 2024-11-27 06:10:30 +00:00
Don't g_strsplit everytime, use strtok.
This commit is contained in:
parent
45c70cbecf
commit
9938317dc5
3 changed files with 9 additions and 5 deletions
|
@ -108,7 +108,7 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0])
|
|||
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama])
|
||||
PKG_CHECK_MODULES([pango], [pango pangocairo])
|
||||
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
|
||||
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0])
|
||||
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 libprofiler])
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------
|
||||
|
|
|
@ -1025,14 +1025,17 @@ int main ( int argc, char *argv[] )
|
|||
if ( !dmenu_mode ) {
|
||||
// setup_modi
|
||||
setup_modi ();
|
||||
TICK_N ( "Setup Modi" );
|
||||
}
|
||||
|
||||
if ( find_arg ( "-no-config" ) < 0 ) {
|
||||
// Reload for dynamic part.
|
||||
load_configuration_dynamic ( );
|
||||
TICK_N ( "Load config dynamic" );
|
||||
}
|
||||
// Parse command line for settings, independent of other -no-config.
|
||||
config_parse_cmd_options_dynamic ( );
|
||||
TICK_N ( "Load cmd config dynamic" );
|
||||
|
||||
if ( config.theme ) {
|
||||
TICK_N ( "Parse theme" );
|
||||
|
|
|
@ -314,17 +314,18 @@ static ThemeWidget *rofi_theme_find ( ThemeWidget *widget, const char *name, con
|
|||
if ( widget == NULL || name == NULL ) {
|
||||
return widget;
|
||||
}
|
||||
char **names = g_strsplit ( name, ".", 0 );
|
||||
char *tname = g_strdup(name );
|
||||
char *saveptr = NULL;
|
||||
int found = TRUE;
|
||||
for ( unsigned int i = 0; found && names && names[i]; i++ ) {
|
||||
for (const char *iter = strtok_r (tname, ".", &saveptr); iter != NULL ; iter = strtok_r ( NULL, "." , &saveptr ) ) {
|
||||
found = FALSE;
|
||||
ThemeWidget *f = rofi_theme_find_single ( widget, names[i] );
|
||||
ThemeWidget *f = rofi_theme_find_single ( widget, iter );
|
||||
if ( f != widget ) {
|
||||
widget = f;
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
g_strfreev ( names );
|
||||
g_free ( tname );
|
||||
if ( !exact || found ) {
|
||||
return widget;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue