Skip to content

Commit eee5d44

Browse files
committed
container traits: remove normalisation
These were added before the big refactoring around templates. The space issues have been solved since then, and these extra normalisations are not necessary anymore I just added them at one point to be able to fix some tests and get a better visibility This should slightly improve performance as we remove an unnecessary operation
1 parent 446e873 commit eee5d44

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/pygccxml/declarations/container_traits.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def erase_allocator(self, cls_name, default_allocator='std::allocator'):
109109
container=c_name,
110110
value_type=value_type,
111111
allocator=default_allocator)
112-
if self.normalize(cls_name) == \
113-
self.normalize(tmpl):
112+
if cls_name == tmpl:
114113
return templates.join(
115114
c_name, [self.erase_recursive(value_type)])
116115

@@ -120,8 +119,8 @@ def erase_container(self, cls_name, default_container_name='std::deque'):
120119
return
121120
value_type = c_args[0]
122121
dc_no_defaults = self.erase_recursive(c_args[1])
123-
if self.normalize(dc_no_defaults) == self.normalize(
124-
templates.join(default_container_name, [value_type])):
122+
if dc_no_defaults == \
123+
templates.join(default_container_name, [value_type]):
125124
return templates.join(
126125
c_name, [self.erase_recursive(value_type)])
127126

@@ -134,12 +133,12 @@ def erase_container_compare(
134133
if len(c_args) != 3:
135134
return
136135
dc_no_defaults = self.erase_recursive(c_args[1])
137-
if self.normalize(dc_no_defaults) != self.normalize(
138-
templates.join(default_container_name, [c_args[0]])):
136+
if dc_no_defaults != \
137+
templates.join(default_container_name, [c_args[0]]):
139138
return
140139
dcomp_no_defaults = self.erase_recursive(c_args[2])
141-
if self.normalize(dcomp_no_defaults) != self.normalize(
142-
templates.join(default_compare, [c_args[0]])):
140+
if dcomp_no_defaults != \
141+
templates.join(default_compare, [c_args[0]]):
143142
return
144143
value_type = self.erase_recursive(c_args[0])
145144
return templates.join(c_name, [value_type])
@@ -161,8 +160,7 @@ def erase_compare_allocator(
161160
value_type=value_type,
162161
compare=default_compare,
163162
allocator=default_allocator)
164-
if self.normalize(cls_name) == \
165-
self.normalize(tmpl):
163+
if cls_name == tmpl:
166164
return templates.join(
167165
c_name, [self.erase_recursive(value_type)])
168166

@@ -193,7 +191,7 @@ def erase_map_compare_allocator(
193191
mapped_type=mapped_type,
194192
compare=default_compare,
195193
allocator=default_allocator)
196-
if self.normalize(cls_name) == self.normalize(tmpl):
194+
if cls_name == tmpl:
197195
return templates.join(
198196
c_name,
199197
[self.erase_recursive(key_type),
@@ -231,8 +229,7 @@ def erase_hash_allocator(self, cls_name):
231229
less=default_less,
232230
equal_to=default_equal_to,
233231
allocator=default_allocator)
234-
if self.normalize(cls_name) == \
235-
self.normalize(inst):
232+
if cls_name == inst:
236233
return templates.join(
237234
c_name, [self.erase_recursive(value_type)])
238235

@@ -309,7 +306,7 @@ def erase_hashmap_compare_allocator(self, cls_name):
309306
equal_to=default_equal_to,
310307
allocator=default_allocator)
311308

312-
if self.normalize(cls_name) == self.normalize(inst):
309+
if cls_name == inst:
313310
return templates.join(
314311
c_name,
315312
[self.erase_recursive(key_type),

0 commit comments

Comments
 (0)