mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Use memmove in buffer/blit when needed.
This commit is contained in:
		| @@ -315,9 +315,13 @@ static Janet cfun_buffer_blit(int32_t argc, Janet *argv) { | ||||
|     if (last > INT32_MAX) | ||||
|         janet_panic("buffer blit out of range"); | ||||
|     janet_buffer_ensure(dest, (int32_t) last, 2); | ||||
|     if (same_buf) src.bytes = dest->data; | ||||
|     if (last > dest->count) dest->count = (int32_t) last; | ||||
|     memcpy(dest->data + offset_dest, src.bytes + offset_src, length_src); | ||||
|     if (same_buf) { | ||||
|         src.bytes = dest->data; | ||||
|         memmove(dest->data + offset_dest, src.bytes + offset_src, length_src); | ||||
|     } else { | ||||
|         memcpy(dest->data + offset_dest, src.bytes + offset_src, length_src); | ||||
|     } | ||||
|     return argv[0]; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose