| 
									
										
										
										
											2007-12-10 15:50:56 +00:00
										 |  |  | /* Fast unicode equal function optimized for dictobject.c and setobject.c */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Return 1 if two unicode objects are equal, 0 if not.
 | 
					
						
							|  |  |  |  * unicode_eq() is called when the hash of two unicode objects is equal. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | Py_LOCAL_INLINE(int) | 
					
						
							|  |  |  | unicode_eq(PyObject *aa, PyObject *bb) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-05-09 15:52:27 +00:00
										 |  |  |     register PyUnicodeObject *a = (PyUnicodeObject *)aa; | 
					
						
							|  |  |  |     register PyUnicodeObject *b = (PyUnicodeObject *)bb; | 
					
						
							| 
									
										
										
										
											2007-12-10 15:50:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-09 15:52:27 +00:00
										 |  |  |     if (a->length != b->length) | 
					
						
							|  |  |  |         return 0; | 
					
						
							|  |  |  |     if (a->length == 0) | 
					
						
							|  |  |  |         return 1; | 
					
						
							|  |  |  |     if (a->str[0] != b->str[0]) | 
					
						
							|  |  |  |         return 0; | 
					
						
							|  |  |  |     if (a->length == 1) | 
					
						
							|  |  |  |         return 1; | 
					
						
							|  |  |  |     return memcmp(a->str, b->str, a->length * sizeof(Py_UNICODE)) == 0; | 
					
						
							| 
									
										
										
										
											2007-12-10 15:50:56 +00:00
										 |  |  | } |