Skip to content

Commit

Permalink
Add G_DEFINE_QUARK and __OPTIMIZE__ to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Apr 23, 2024
1 parent 7d7c6d8 commit 332179f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ PROJECT(${name}
DESCRIPTION "CLI keyboard layout switcher for Gnome 3 and 4x"
VERSION ${VERSION})
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
ADD_DEFINITIONS(-D__OPTIMIZE__)

INCLUDE(GNUInstallDirs)
INCLUDE(CMakeDependentOption)
Expand Down
9 changes: 2 additions & 7 deletions switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#define G3KB_SWITCH_MAX_LAYOUTS 256
#define G3KB_SWITCH_DBUS_CALL_TIMEOUT 2000

#define G3KB_SWITCH_ERROR g3kb_switch_error()
static G_DEFINE_QUARK(g3kb_switch_error_quark, g3kb_switch_error)
#define G3KB_SWITCH_ERROR g3kb_switch_error_quark()

#define G3KB_SWITCH_ERROR_RUN_METHOD 1
#define G3KB_SWITCH_ERROR_BUILD_LAYOUTS_MAP 2
Expand All @@ -48,12 +49,6 @@ struct next_key_search_data
};


static GQuark g3kb_switch_error( void )
{
return g_quark_from_static_string( "g3kb-switch-error-quark" );
}


/* compare two guintptr values */
static gint key_compare( gconstpointer k1, gconstpointer k2, gpointer unused )
{
Expand Down

0 comments on commit 332179f

Please sign in to comment.