Fix page replace was broken if passed the same page pointer
							parent
							
								
									918a2a0192
								
							
						
					
					
						commit
						c914cddcc3
					
				|  | @ -66,6 +66,10 @@ | |||
|  * @brief No more pages left in the file. | ||||
|  */ | ||||
| #define YDB_ERR_NO_MORE_PAGES               (-12) | ||||
| /**
 | ||||
|  * @brief The addresses of pages are the same. | ||||
|  */ | ||||
| #define YDB_ERR_SAME_PAGE_ADDRESS           (-13) | ||||
| /**
 | ||||
|  * @brief An unknown error has occurred. | ||||
|  */ | ||||
|  |  | |||
|  | @ -318,6 +318,10 @@ YDB_Error ydb_replace_current_page(YDB_Engine *instance, YDB_TablePage *page) { | |||
|   THROW_IF_NULL(instance->in_use, YDB_ERR_INSTANCE_NOT_IN_USE); | ||||
|   THROW_IF_NULL(page, YDB_ERR_PAGE_NOT_INITIALIZED); | ||||
| 
 | ||||
|   if (instance->curr_page == page) { | ||||
|     return YDB_ERR_SAME_PAGE_ADDRESS; | ||||
|   } | ||||
| 
 | ||||
|   // Seek to current page in file
 | ||||
|   fseek(instance->fd, instance->curr_page_offset, SEEK_SET); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue