jcs ratpoison hax

Better, faster, prettier groups_find_by_group_name

* there are really two operation modes that could even be put into separate
functions. So disentangle the logic and put the operation mode check
outside of the loop parsing the groups list.

+11 -4
+11 -4
src/group.c
··· 232 232 { 233 233 rp_group *cur; 234 234 235 - list_for_each_entry (cur, &rp_groups, node) 235 + if (!exact_match) 236 + { 237 + list_for_each_entry (cur, &rp_groups, node) 238 + { 239 + if (cur->name && str_comp (s, cur->name, strlen (s))) 240 + return cur; 241 + } 242 + } 243 + else 236 244 { 237 - if (cur->name) 245 + list_for_each_entry (cur, &rp_groups, node) 238 246 { 239 - if ((!exact_match && str_comp (s, cur->name, strlen (s))) || 240 - (exact_match && !strcmp (cur->name, s))) 247 + if (cur->name && !strcmp (cur->name, s)) 241 248 return cur; 242 249 } 243 250 }