@@ -394,20 +394,22 @@ def get_preferred_struct_name(_names):
394394 r = re .compile (r"^[sS].*" )
395395 r_underscore = re .compile (r"^(?![_]).*" )
396396 r_end_t = re .compile (r"^.*(_[tT])$" )
397+ # Find any that don't start with _ for _t matching below
398+ struct_name_no_underscore = list (filter (r_underscore .match , names ))
397399 # Remove all instances of _t at end unless that is all we have
398- setting_structures_with_t = list (filter (r_end_t .match , names ))
399- if len (setting_structures_with_t ):
400- if len (setting_structures_with_t ) != len (names ):
401- for name in setting_structures_with_t :
400+ struct_name_with_t = list (filter (r_end_t .match , struct_name_no_underscore ))
401+ if len (struct_name_with_t ):
402+ if len (struct_name_with_t ) != len (struct_name_no_underscore ):
403+ for name in struct_name_with_t :
402404 names .remove (name )
403405 # Find any that start with 'S' and prefer that
404- setting_structures = list (filter (r .match , names ))
405- if setting_structures :
406- return setting_structures [0 ]
406+ struct_name_with_s = list (filter (r .match , names ))
407+ if struct_name_with_s :
408+ return struct_name_with_s [0 ]
407409 # Find any that don't start with _ and prefer that
408- setting_structures = list (filter (r_underscore .match , names ))
409- if setting_structures :
410- return setting_structures [0 ]
410+ struct_name_no_underscore = list (filter (r_underscore .match , names ))
411+ if struct_name_no_underscore :
412+ return struct_name_no_underscore [0 ]
411413 try :
412414 return names [0 ]
413415 except IndexError as _ :
0 commit comments