mirror of
				https://github.com/python/cpython.git
				synced 2025-10-26 03:04:41 +00:00 
			
		
		
		
	Reflow long lines and reformat.
This commit is contained in:
		
							parent
							
								
									37a724d718
								
							
						
					
					
						commit
						1aad9c7dad
					
				
					 1 changed files with 13 additions and 13 deletions
				
			
		|  | @ -2363,33 +2363,33 @@ filterunicode(PyObject *func, PyObject *strobj) | ||||||
| 		if (ok) { | 		if (ok) { | ||||||
| 			int reslen; | 			int reslen; | ||||||
| 			if (!PyUnicode_Check(item)) { | 			if (!PyUnicode_Check(item)) { | ||||||
| 				PyErr_SetString(PyExc_TypeError, "can't filter unicode to unicode:" | 				PyErr_SetString(PyExc_TypeError,  | ||||||
|  | 				"can't filter unicode to unicode:" | ||||||
| 				" __getitem__ returned different type"); | 				" __getitem__ returned different type"); | ||||||
| 				Py_DECREF(item); | 				Py_DECREF(item); | ||||||
| 				goto Fail_1; | 				goto Fail_1; | ||||||
| 			} | 			} | ||||||
| 			reslen = PyUnicode_GET_SIZE(item); | 			reslen = PyUnicode_GET_SIZE(item); | ||||||
| 			if (reslen == 1) { | 			if (reslen == 1)  | ||||||
| 				PyUnicode_AS_UNICODE(result)[j++] = | 				PyUnicode_AS_UNICODE(result)[j++] = | ||||||
| 					PyUnicode_AS_UNICODE(item)[0]; | 					PyUnicode_AS_UNICODE(item)[0]; | ||||||
| 			} else { | 			else { | ||||||
| 				/* do we need more space? */ | 				/* do we need more space? */ | ||||||
| 				int need = j + reslen + len-i-1; | 				int need = j + reslen + len - i - 1; | ||||||
| 				if (need > outlen) { | 				if (need > outlen) { | ||||||
| 					/* overallocate, to avoid reallocations */ | 					/* overallocate, 
 | ||||||
| 					if (need<2*outlen) | 					   to avoid reallocations */ | ||||||
| 						need = 2*outlen; | 					if (need < 2 * outlen) | ||||||
|  | 						need = 2 * outlen; | ||||||
| 					if (PyUnicode_Resize(&result, need)) { | 					if (PyUnicode_Resize(&result, need)) { | ||||||
| 						Py_DECREF(item); | 						Py_DECREF(item); | ||||||
| 						goto Fail_1; | 						goto Fail_1; | ||||||
| 					} | 					} | ||||||
| 					outlen = need; | 					outlen = need; | ||||||
| 				} | 				} | ||||||
| 				memcpy( | 				memcpy(PyUnicode_AS_UNICODE(result) + j, | ||||||
| 					PyUnicode_AS_UNICODE(result) + j, |  | ||||||
| 				       PyUnicode_AS_UNICODE(item), | 				       PyUnicode_AS_UNICODE(item), | ||||||
| 					reslen*sizeof(Py_UNICODE) | 				       reslen*sizeof(Py_UNICODE)); | ||||||
| 				); |  | ||||||
| 				j += reslen; | 				j += reslen; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Hylton
						Jeremy Hylton