You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Most of the *Free() functions are pretty generic so add macros to make creating them as easy as possible. Create a distinction between *Free() functions that the caller uses to free memory and callbacks that free third-party resources. There are a number of cases where a driver needs to free resources but does not need a normal *Free() because it is handled by the interface. Add common/object.h for macros that make object maintenance easier. This pattern can also be used for many more object functions.
		
			
				
	
	
		
			46 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /***********************************************************************************************************************************
 | |
| Storage Read Interface
 | |
| ***********************************************************************************************************************************/
 | |
| #ifndef STORAGE_READ_H
 | |
| #define STORAGE_READ_H
 | |
| 
 | |
| /***********************************************************************************************************************************
 | |
| Object type
 | |
| ***********************************************************************************************************************************/
 | |
| #define STORAGE_READ_TYPE                                           StorageRead
 | |
| #define STORAGE_READ_PREFIX                                         storageRead
 | |
| 
 | |
| typedef struct StorageRead StorageRead;
 | |
| 
 | |
| #include "common/io/read.h"
 | |
| 
 | |
| /***********************************************************************************************************************************
 | |
| Functions
 | |
| ***********************************************************************************************************************************/
 | |
| StorageRead *storageReadMove(StorageRead *this, MemContext *parentNew);
 | |
| 
 | |
| /***********************************************************************************************************************************
 | |
| Getters
 | |
| ***********************************************************************************************************************************/
 | |
| IoRead *storageReadIo(const StorageRead *this);
 | |
| bool storageReadIgnoreMissing(const StorageRead *this);
 | |
| const String *storageReadName(const StorageRead *this);
 | |
| const String *storageReadType(const StorageRead *this);
 | |
| 
 | |
| /***********************************************************************************************************************************
 | |
| Destructor
 | |
| ***********************************************************************************************************************************/
 | |
| void storageReadFree(StorageRead *this);
 | |
| 
 | |
| /***********************************************************************************************************************************
 | |
| Macros for function logging
 | |
| ***********************************************************************************************************************************/
 | |
| String *storageReadToLog(const StorageRead *this);
 | |
| 
 | |
| #define FUNCTION_LOG_STORAGE_READ_TYPE                                                                                             \
 | |
|     StorageRead *
 | |
| #define FUNCTION_LOG_STORAGE_READ_FORMAT(value, buffer, bufferSize)                                                                \
 | |
|     FUNCTION_LOG_STRING_OBJECT_FORMAT(value, storageReadToLog, buffer, bufferSize)
 | |
| 
 | |
| #endif
 |