@@ -2,7 +2,7 @@ import functools
2
2
import uuid
3
3
4
4
from libc.stdint cimport uint8_t, int8_t
5
- from libc.string cimport memcpy, strncmp
5
+ from libc.string cimport memcpy, memcmp
6
6
7
7
8
8
# A more efficient UUID type implementation
@@ -184,42 +184,42 @@ cdef class UUID(__UUIDReplaceMe):
184
184
185
185
def __eq__ (self , other ):
186
186
if type (other) is UUID:
187
- return strncmp (self ._data, (< UUID> other)._data, 16 ) == 0
187
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) == 0
188
188
if isinstance (other, std_UUID):
189
189
return self .int == other.int
190
190
return NotImplemented
191
191
192
192
def __ne__ (self , other ):
193
193
if type (other) is UUID:
194
- return strncmp (self ._data, (< UUID> other)._data, 16 ) != 0
194
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) != 0
195
195
if isinstance (other, std_UUID):
196
196
return self .int != other.int
197
197
return NotImplemented
198
198
199
199
def __lt__ (self , other ):
200
200
if type (other) is UUID:
201
- return strncmp (self ._data, (< UUID> other)._data, 16 ) < 0
201
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) < 0
202
202
if isinstance (other, std_UUID):
203
203
return self .int < other.int
204
204
return NotImplemented
205
205
206
206
def __gt__ (self , other ):
207
207
if type (other) is UUID:
208
- return strncmp (self ._data, (< UUID> other)._data, 16 ) > 0
208
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) > 0
209
209
if isinstance (other, std_UUID):
210
210
return self .int > other.int
211
211
return NotImplemented
212
212
213
213
def __le__ (self , other ):
214
214
if type (other) is UUID:
215
- return strncmp (self ._data, (< UUID> other)._data, 16 ) <= 0
215
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) <= 0
216
216
if isinstance (other, std_UUID):
217
217
return self .int <= other.int
218
218
return NotImplemented
219
219
220
220
def __ge__ (self , other ):
221
221
if type (other) is UUID:
222
- return strncmp (self ._data, (< UUID> other)._data, 16 ) >= 0
222
+ return memcmp (self ._data, (< UUID> other)._data, 16 ) >= 0
223
223
if isinstance (other, std_UUID):
224
224
return self .int >= other.int
225
225
return NotImplemented
0 commit comments