@@ -202,31 +202,23 @@ gint text_char_to_num(gchar c)
202202 return 0 ;
203203}
204204
205- void layout_config_order_from_text (const gchar *text, gint &a, gint &b, gint &c )
205+ std::tuple< int , int , int > layout_config_order_from_text (const gchar *text)
206206{
207- if (!text || strlen (text) < 3 )
208- {
209- a = 0 ;
210- b = 1 ;
211- c = 2 ;
212- }
213- else
214- {
215- a = text_char_to_num (text[0 ]);
216- b = text_char_to_num (text[1 ]);
217- c = text_char_to_num (text[2 ]);
218- }
207+ if (!text || strlen (text) < 3 ) return { 0 , 1 , 2 };
208+
209+ const int a = text_char_to_num (text[0 ]);
210+ const int b = text_char_to_num (text[1 ]);
211+ const int c = text_char_to_num (text[2 ]);
212+
213+ return { a, b, c };
219214}
220215
221216} // namespace
222217
223218void layout_config_parse (gint style, const gchar *order,
224219 LayoutLocation &a, LayoutLocation &b, LayoutLocation &c)
225220{
226- gint oa;
227- gint ob;
228- gint oc;
229- layout_config_order_from_text (order, oa, ob, oc);
221+ const auto [oa, ob, oc] = layout_config_order_from_text (order);
230222
231223 style = std::clamp<int >(style, 0 , layout_config_styles.size ());
232224 LayoutStyle ls = layout_config_styles[style];
@@ -248,10 +240,7 @@ void layout_config_set(GtkWidget *widget, gint style, const gchar *order)
248240 style = std::clamp<int >(style, 0 , layout_config_styles.size ());
249241 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lc->style_widgets [style]), TRUE );
250242
251- gint a;
252- gint b;
253- gint c;
254- layout_config_order_from_text (order, a, b, c);
243+ const auto [a, b, c] = layout_config_order_from_text (order);
255244
256245 layout_config_list_order_set (lc, a, 0 );
257246 layout_config_list_order_set (lc, b, 1 );
0 commit comments