You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Add macros for object free functions.
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.
This commit is contained in:
		| @@ -67,6 +67,10 @@ | ||||
|                         <p>Add <file>common/macro.h</file> for general-purpose macros.</p> | ||||
|                     </release-item> | ||||
|  | ||||
|                     <release-item> | ||||
|                         <p>Add macros for object free functions.</p> | ||||
|                     </release-item> | ||||
|  | ||||
|                     <release-item> | ||||
|                         <p>Various <code>MemContext</code> callback improvements.</p> | ||||
|                     </release-item> | ||||
|   | ||||
| @@ -232,19 +232,19 @@ command/remote/remote.o: command/remote/remote.c build.auto.h common/assert.h co | ||||
| common/compress/gzip/common.o: common/compress/gzip/common.c build.auto.h common/assert.h common/compress/gzip/common.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/compress/gzip/common.c -o common/compress/gzip/common.o | ||||
|  | ||||
| common/compress/gzip/compress.o: common/compress/gzip/compress.c build.auto.h common/assert.h common/compress/gzip/common.h common/compress/gzip/compress.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/compress/gzip/compress.o: common/compress/gzip/compress.c build.auto.h common/assert.h common/compress/gzip/common.h common/compress/gzip/compress.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/compress/gzip/compress.c -o common/compress/gzip/compress.o | ||||
|  | ||||
| common/compress/gzip/decompress.o: common/compress/gzip/decompress.c build.auto.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/compress/gzip/decompress.o: common/compress/gzip/decompress.c build.auto.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/compress/gzip/decompress.c -o common/compress/gzip/decompress.o | ||||
|  | ||||
| common/crypto/cipherBlock.o: common/crypto/cipherBlock.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/crypto/cipherBlock.o: common/crypto/cipherBlock.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/crypto/cipherBlock.c -o common/crypto/cipherBlock.o | ||||
|  | ||||
| common/crypto/common.o: common/crypto/common.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/crypto/common.c -o common/crypto/common.o | ||||
|  | ||||
| common/crypto/hash.o: common/crypto/hash.c build.auto.h common/assert.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/crypto/hash.o: common/crypto/hash.c build.auto.h common/assert.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/crypto/hash.c -o common/crypto/hash.o | ||||
|  | ||||
| common/debug.o: common/debug.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| @@ -259,7 +259,7 @@ common/encode/base64.o: common/encode/base64.c build.auto.h common/assert.h comm | ||||
| common/error.o: common/error.c build.auto.h common/error.auto.c common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/error.c -o common/error.o | ||||
|  | ||||
| common/exec.o: common/exec.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| common/exec.o: common/exec.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/exec.c -o common/exec.o | ||||
|  | ||||
| common/exit.o: common/exit.c build.auto.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h perl/exec.h protocol/client.h protocol/command.h protocol/helper.h | ||||
| @@ -268,55 +268,55 @@ common/exit.o: common/exit.c build.auto.h command/command.h common/assert.h comm | ||||
| common/fork.o: common/fork.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/fork.c -o common/fork.o | ||||
|  | ||||
| common/ini.o: common/ini.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/ini.o: common/ini.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/ini.c -o common/ini.o | ||||
|  | ||||
| common/io/bufferRead.o: common/io/bufferRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/bufferRead.o: common/io/bufferRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferRead.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/bufferRead.c -o common/io/bufferRead.o | ||||
|  | ||||
| common/io/bufferWrite.o: common/io/bufferWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferWrite.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/bufferWrite.o: common/io/bufferWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/bufferWrite.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/bufferWrite.c -o common/io/bufferWrite.o | ||||
|  | ||||
| common/io/filter/buffer.o: common/io/filter/buffer.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/filter/buffer.o: common/io/filter/buffer.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/filter/buffer.c -o common/io/filter/buffer.o | ||||
|  | ||||
| common/io/filter/filter.o: common/io/filter/filter.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/filter/filter.o: common/io/filter/filter.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/filter/filter.c -o common/io/filter/filter.o | ||||
|  | ||||
| common/io/filter/group.o: common/io/filter/group.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/filter/group.o: common/io/filter/group.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/buffer.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/io.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/filter/group.c -o common/io/filter/group.o | ||||
|  | ||||
| common/io/filter/size.o: common/io/filter/size.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/size.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/filter/size.o: common/io/filter/size.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/size.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/filter/size.c -o common/io/filter/size.o | ||||
|  | ||||
| common/io/handleRead.o: common/io/handleRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/handleRead.o: common/io/handleRead.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/handleRead.c -o common/io/handleRead.o | ||||
|  | ||||
| common/io/handleWrite.o: common/io/handleWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/handleWrite.o: common/io/handleWrite.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/handleWrite.c -o common/io/handleWrite.o | ||||
|  | ||||
| common/io/http/client.o: common/io/http/client.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| common/io/http/client.o: common/io/http/client.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/http/client.c -o common/io/http/client.o | ||||
|  | ||||
| common/io/http/common.o: common/io/http/common.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/http/common.c -o common/io/http/common.o | ||||
|  | ||||
| common/io/http/header.o: common/io/http/header.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/header.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| common/io/http/header.o: common/io/http/header.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/header.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/http/header.c -o common/io/http/header.o | ||||
|  | ||||
| common/io/http/query.o: common/io/http/query.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/io/http/query.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| common/io/http/query.o: common/io/http/query.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/http/common.h common/io/http/query.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/http/query.c -o common/io/http/query.o | ||||
|  | ||||
| common/io/io.o: common/io/io.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/io.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/io.c -o common/io/io.o | ||||
|  | ||||
| common/io/read.o: common/io/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/read.o: common/io/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/read.c -o common/io/read.o | ||||
|  | ||||
| common/io/tls/client.o: common/io/tls/client.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| common/io/tls/client.o: common/io/tls/client.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/tls/client.c -o common/io/tls/client.o | ||||
|  | ||||
| common/io/write.o: common/io/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| common/io/write.o: common/io/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/io/write.c -o common/io/write.o | ||||
|  | ||||
| common/lock.o: common/lock.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/helper.h storage/info.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| @@ -328,7 +328,7 @@ common/log.o: common/log.c build.auto.h common/assert.h common/debug.h common/er | ||||
| common/memContext.o: common/memContext.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/memContext.c -o common/memContext.o | ||||
|  | ||||
| common/regExp.o: common/regExp.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| common/regExp.o: common/regExp.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/regExp.c -o common/regExp.o | ||||
|  | ||||
| common/stackTrace.o: common/stackTrace.c build.auto.h common/assert.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h | ||||
| @@ -337,7 +337,7 @@ common/stackTrace.o: common/stackTrace.c build.auto.h common/assert.h common/err | ||||
| common/time.o: common/time.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/time.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/time.c -o common/time.o | ||||
|  | ||||
| common/type/buffer.o: common/type/buffer.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| common/type/buffer.o: common/type/buffer.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/buffer.c -o common/type/buffer.o | ||||
|  | ||||
| common/type/convert.o: common/type/convert.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| @@ -346,10 +346,10 @@ common/type/convert.o: common/type/convert.c build.auto.h common/assert.h common | ||||
| common/type/json.o: common/type/json.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/json.c -o common/type/json.o | ||||
|  | ||||
| common/type/keyValue.o: common/type/keyValue.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| common/type/keyValue.o: common/type/keyValue.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/keyValue.c -o common/type/keyValue.o | ||||
|  | ||||
| common/type/list.o: common/type/list.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h | ||||
| common/type/list.o: common/type/list.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/list.c -o common/type/list.o | ||||
|  | ||||
| common/type/string.o: common/type/string.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/macro.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h | ||||
| @@ -364,10 +364,10 @@ common/type/variant.o: common/type/variant.c build.auto.h common/assert.h common | ||||
| common/type/variantList.o: common/type/variantList.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/variantList.c -o common/type/variantList.o | ||||
|  | ||||
| common/type/xml.o: common/type/xml.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h common/type/xml.h | ||||
| common/type/xml.o: common/type/xml.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/list.h common/type/string.h common/type/xml.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/type/xml.c -o common/type/xml.o | ||||
|  | ||||
| common/wait.o: common/wait.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/convert.h common/wait.h | ||||
| common/wait.o: common/wait.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/convert.h common/wait.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c common/wait.c -o common/wait.o | ||||
|  | ||||
| config/config.o: config/config.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.c config/config.auto.h config/config.h config/define.auto.h config/define.h | ||||
| @@ -388,19 +388,19 @@ config/parse.o: config/parse.c build.auto.h common/assert.h common/debug.h commo | ||||
| config/protocol.o: config/protocol.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/server.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c config/protocol.c -o config/protocol.o | ||||
|  | ||||
| info/info.o: info/info.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h version.h | ||||
| info/info.o: info/info.c build.auto.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/filter.intern.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c info/info.c -o info/info.o | ||||
|  | ||||
| info/infoArchive.o: info/infoArchive.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| info/infoArchive.o: info/infoArchive.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c info/infoArchive.c -o info/infoArchive.o | ||||
|  | ||||
| info/infoBackup.o: info/infoBackup.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| info/infoBackup.o: info/infoBackup.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c info/infoBackup.c -o info/infoBackup.o | ||||
|  | ||||
| info/infoManifest.o: info/infoManifest.c build.auto.h common/error.auto.h common/error.h common/memContext.h common/type/buffer.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h info/infoManifest.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c info/infoManifest.c -o info/infoManifest.o | ||||
|  | ||||
| info/infoPg.o: info/infoPg.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| info/infoPg.o: info/infoPg.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/helper.h storage/info.h storage/read.h storage/storage.h storage/write.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c info/infoPg.c -o info/infoPg.o | ||||
|  | ||||
| main.o: main.c build.auto.h command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h command/info/info.h command/local/local.h command/remote/remote.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h | ||||
| @@ -451,25 +451,25 @@ postgres/interface/v110.o: postgres/interface/v110.c build.auto.h common/assert. | ||||
| postgres/pageChecksum.o: postgres/pageChecksum.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h postgres/pageChecksum.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) @COPTIMIZE_PAGE_CHECKSUM@ -c postgres/pageChecksum.c -o postgres/pageChecksum.o | ||||
|  | ||||
| protocol/client.o: protocol/client.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h version.h | ||||
| protocol/client.o: protocol/client.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/client.c -o protocol/client.o | ||||
|  | ||||
| protocol/command.o: protocol/command.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/command.h | ||||
| protocol/command.o: protocol/command.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/command.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/command.c -o protocol/command.o | ||||
|  | ||||
| protocol/helper.o: protocol/helper.c build.auto.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/helper.c -o protocol/helper.o | ||||
|  | ||||
| protocol/parallel.o: protocol/parallel.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/parallel.h protocol/parallelJob.h | ||||
| protocol/parallel.o: protocol/parallel.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/parallel.h protocol/parallelJob.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/parallel.c -o protocol/parallel.o | ||||
|  | ||||
| protocol/parallelJob.o: protocol/parallelJob.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/parallelJob.h | ||||
| protocol/parallelJob.o: protocol/parallelJob.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/parallelJob.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/parallelJob.c -o protocol/parallelJob.o | ||||
|  | ||||
| protocol/server.o: protocol/server.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h version.h | ||||
| protocol/server.o: protocol/server.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c protocol/server.c -o protocol/server.o | ||||
|  | ||||
| storage/cifs/storage.o: storage/cifs/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/cifs/storage.h storage/info.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/cifs/storage.o: storage/cifs/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/cifs/storage.h storage/info.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/cifs/storage.c -o storage/cifs/storage.o | ||||
|  | ||||
| storage/helper.o: storage/helper.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/client.h protocol/command.h protocol/helper.h storage/cifs/storage.h storage/helper.h storage/info.h storage/posix/storage.h storage/read.h storage/read.intern.h storage/remote/storage.h storage/s3/storage.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| @@ -478,41 +478,41 @@ storage/helper.o: storage/helper.c build.auto.h common/assert.h common/debug.h c | ||||
| storage/posix/common.o: storage/posix/common.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/string.h storage/posix/common.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/common.c -o storage/posix/common.o | ||||
|  | ||||
| storage/posix/read.o: storage/posix/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/posix/read.o: storage/posix/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/read.c -o storage/posix/read.o | ||||
|  | ||||
| storage/posix/storage.o: storage/posix/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/posix/storage.o: storage/posix/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/read.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/storage.c -o storage/posix/storage.o | ||||
|  | ||||
| storage/posix/write.o: storage/posix/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/posix/write.o: storage/posix/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/posix/common.h storage/posix/storage.h storage/posix/storage.intern.h storage/posix/write.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/posix/write.c -o storage/posix/write.o | ||||
|  | ||||
| storage/read.o: storage/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/read.h storage/read.intern.h | ||||
| storage/read.o: storage/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/read.h storage/read.intern.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/read.c -o storage/read.o | ||||
|  | ||||
| storage/remote/protocol.o: storage/remote/protocol.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/server.h storage/helper.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/protocol.c -o storage/remote/protocol.o | ||||
|  | ||||
| storage/remote/read.o: storage/remote/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/remote/read.o: storage/remote/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/read.c -o storage/remote/read.o | ||||
|  | ||||
| storage/remote/storage.o: storage/remote/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/remote/storage.o: storage/remote/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/read.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/storage.c -o storage/remote/storage.o | ||||
|  | ||||
| storage/remote/write.o: storage/remote/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/remote/write.o: storage/remote/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/server.h storage/info.h storage/read.h storage/read.intern.h storage/remote/protocol.h storage/remote/storage.h storage/remote/storage.intern.h storage/remote/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/remote/write.c -o storage/remote/write.o | ||||
|  | ||||
| storage/s3/read.o: storage/s3/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/s3/read.o: storage/s3/read.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/read.c -o storage/s3/read.o | ||||
|  | ||||
| storage/s3/storage.o: storage/s3/storage.c build.auto.h common/assert.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/s3/storage.o: storage/s3/storage.c build.auto.h common/assert.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/read.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/storage.c -o storage/s3/storage.o | ||||
|  | ||||
| storage/s3/write.o: storage/s3/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/s3/write.o: storage/s3/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/info.h storage/read.h storage/read.intern.h storage/s3/storage.h storage/s3/storage.intern.h storage/s3/write.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/s3/write.c -o storage/s3/write.o | ||||
|  | ||||
| storage/storage.o: storage/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/info.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| storage/storage.o: storage/storage.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h storage/info.h storage/read.h storage/read.intern.h storage/storage.h storage/storage.intern.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/storage.c -o storage/storage.o | ||||
|  | ||||
| storage/write.o: storage/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/write.h storage/write.intern.h version.h | ||||
| storage/write.o: storage/write.c build.auto.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/macro.h common/memContext.h common/object.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/write.h storage/write.intern.h version.h | ||||
| 	$(CC) $(CFLAGS) $(CMAKE) -c storage/write.c -o storage/write.o | ||||
|   | ||||
| @@ -23,6 +23,9 @@ Filter type constant | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define GZIP_COMPRESS_TYPE                                          GzipCompress | ||||
| #define GZIP_COMPRESS_PREFIX                                        gzipCompress | ||||
|  | ||||
| typedef struct GzipCompress | ||||
| { | ||||
|     MemContext *memContext;                                         // Context to store data | ||||
| @@ -54,6 +57,15 @@ Compression constants | ||||
| ***********************************************************************************************************************************/ | ||||
| #define MEM_LEVEL                                                   9 | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free deflate stream | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(GZIP_COMPRESS, LOG, logLevelTrace) | ||||
| { | ||||
|     deflateEnd(this->stream); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Compress data | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -146,28 +158,6 @@ gzipCompressInputSame(const THIS_VOID) | ||||
|     FUNCTION_TEST_RETURN(this->inputSame); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free memory | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| gzipCompressFree(GzipCompress *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(GZIP_COMPRESS, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         deflateEnd(this->stream); | ||||
|         this->stream = NULL; | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -193,7 +183,7 @@ gzipCompressNew(int level, bool raw) | ||||
|         gzipError(deflateInit2(driver->stream, level, Z_DEFLATED, gzipWindowBits(raw), MEM_LEVEL, Z_DEFAULT_STRATEGY)); | ||||
|  | ||||
|         // Set free callback to ensure gzip context is freed | ||||
|         memContextCallbackSet(driver->memContext, (MemContextCallback)gzipCompressFree, driver); | ||||
|         memContextCallbackSet(driver->memContext, gzipCompressFreeResource, driver); | ||||
|  | ||||
|         // Create filter interface | ||||
|         this = ioFilterNewP( | ||||
|   | ||||
| @@ -23,6 +23,9 @@ Filter type constant | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define GZIP_DECOMPRESS_TYPE                                        GzipDecompress | ||||
| #define GZIP_DECOMPRESS_PREFIX                                      gzipDecompress | ||||
|  | ||||
| typedef struct GzipDecompress | ||||
| { | ||||
|     MemContext *memContext;                                         // Context to store data | ||||
| @@ -49,6 +52,15 @@ gzipDecompressToLog(const GzipDecompress *this) | ||||
| #define FUNCTION_LOG_GZIP_DECOMPRESS_FORMAT(value, buffer, bufferSize)                                                             \ | ||||
|     FUNCTION_LOG_STRING_OBJECT_FORMAT(value, gzipDecompressToLog, buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free inflate stream | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(GZIP_DECOMPRESS, LOG, logLevelTrace) | ||||
| { | ||||
|     inflateEnd(this->stream); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Decompress data | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -125,27 +137,6 @@ gzipDecompressInputSame(const THIS_VOID) | ||||
|     FUNCTION_TEST_RETURN(this->inputSame); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free memory | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| gzipDecompressFree(GzipDecompress *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(GZIP_DECOMPRESS, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         inflateEnd(this->stream); | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -169,7 +160,7 @@ gzipDecompressNew(bool raw) | ||||
|         gzipError(driver->result = inflateInit2(driver->stream, gzipWindowBits(raw))); | ||||
|  | ||||
|         // Set free callback to ensure gzip context is freed | ||||
|         memContextCallbackSet(driver->memContext, (MemContextCallback)gzipDecompressFree, driver); | ||||
|         memContextCallbackSet(driver->memContext, gzipDecompressFreeResource, driver); | ||||
|  | ||||
|         // Create filter interface | ||||
|         this = ioFilterNewP( | ||||
|   | ||||
| @@ -34,8 +34,11 @@ Header constants and sizes | ||||
| #define CIPHER_BLOCK_HEADER_SIZE                                    (CIPHER_BLOCK_MAGIC_SIZE + PKCS5_SALT_LEN) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Track state during block encrypt/decrypt | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define CIPHER_BLOCK_TYPE                                           CipherBlock | ||||
| #define CIPHER_BLOCK_PREFIX                                         cipherBlock | ||||
|  | ||||
| typedef struct CipherBlock | ||||
| { | ||||
|     MemContext *memContext;                                         // Context to store data | ||||
| @@ -71,28 +74,13 @@ cipherBlockToLog(const CipherBlock *this) | ||||
|     FUNCTION_LOG_STRING_OBJECT_FORMAT(value, cipherBlockToLog, buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| Free cipher context | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| cipherBlockFree(CipherBlock *this) | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(CIPHER_BLOCK, LOG, logLevelTrace) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(CIPHER_BLOCK, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         // Free cipher context | ||||
|         if (this->cipherContext) | ||||
|             EVP_CIPHER_CTX_cleanup(this->cipherContext); | ||||
|  | ||||
|         // Free mem context | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
|     EVP_CIPHER_CTX_cleanup(this->cipherContext); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Determine how large the destination buffer should be | ||||
| @@ -200,7 +188,7 @@ cipherBlockProcessBlock(CipherBlock *this, const unsigned char *source, size_t s | ||||
|             cryptoError(!(this->cipherContext = EVP_CIPHER_CTX_new()), "unable to create context"); | ||||
|  | ||||
|             // Set free callback to ensure cipher context is freed | ||||
|             memContextCallbackSet(this->memContext, (MemContextCallback)cipherBlockFree, this); | ||||
|             memContextCallbackSet(this->memContext, cipherBlockFreeResource, this); | ||||
|  | ||||
|             // Initialize cipher | ||||
|             cryptoError( | ||||
|   | ||||
| @@ -32,6 +32,9 @@ STRING_EXTERN(HASH_TYPE_SHA256_STR,                                 HASH_TYPE_SH | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define CRYPTO_HASH_TYPE                                            CryptoHash | ||||
| #define CRYPTO_HASH_PREFIX                                          cryptoHash | ||||
|  | ||||
| typedef struct CryptoHash | ||||
| { | ||||
|     MemContext *memContext;                                         // Context to store data | ||||
| @@ -48,6 +51,15 @@ Macros for function logging | ||||
| #define FUNCTION_LOG_CRYPTO_HASH_FORMAT(value, buffer, bufferSize)                                                                 \ | ||||
|     objToLog(value, "CryptoHash", buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free hash context | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(CRYPTO_HASH, LOG, logLevelTrace) | ||||
| { | ||||
|     EVP_MD_CTX_destroy(this->hashContext); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Add message data to the hash from a Buffer | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -115,21 +127,6 @@ cryptoHashResult(THIS_VOID) | ||||
|     FUNCTION_LOG_RETURN(VARIANT, varNewStr(bufHex(cryptoHash(this)))); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free memory | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| cryptoHashFreeCallback(CryptoHash *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(CRYPTO_HASH, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     EVP_MD_CTX_destroy(this->hashContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -161,7 +158,7 @@ cryptoHashNew(const String *type) | ||||
|         cryptoError((driver->hashContext = EVP_MD_CTX_create()) == NULL, "unable to create hash context"); | ||||
|  | ||||
|         // Set free callback to ensure hash context is freed | ||||
|         memContextCallbackSet(driver->memContext, (MemContextCallback)cryptoHashFreeCallback, driver); | ||||
|         memContextCallbackSet(driver->memContext, cryptoHashFreeResource, driver); | ||||
|  | ||||
|         // Initialize context | ||||
|         cryptoError(!EVP_DigestInit_ex(driver->hashContext, driver->hashType, NULL), "unable to initialize hash context"); | ||||
|   | ||||
| @@ -45,6 +45,8 @@ struct Exec | ||||
|     IoWrite *ioWriteExec;                                           // Wrapper for handle write interface | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(EXEC); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macro to close file descriptors after dup2() in the child process | ||||
|  | ||||
| @@ -68,6 +70,41 @@ other code. | ||||
|     }                                                                                                                              \ | ||||
|     while (0); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free exec handles and ensure process is shut down | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(EXEC, LOG, logLevelTrace) | ||||
| { | ||||
|     // Close the io handles | ||||
|     close(this->handleRead); | ||||
|     close(this->handleWrite); | ||||
|     close(this->handleError); | ||||
|  | ||||
|     // Wait for the child to exit. We don't really care how it exits as long as it does. | ||||
|     if (this->processId != 0) | ||||
|     { | ||||
|         MEM_CONTEXT_TEMP_BEGIN() | ||||
|         { | ||||
|             int processResult = 0; | ||||
|             Wait *wait = waitNew(this->timeout); | ||||
|  | ||||
|             do | ||||
|             { | ||||
|                 THROW_ON_SYS_ERROR( | ||||
|                     (processResult = waitpid(this->processId, NULL, WNOHANG)) == -1, ExecuteError, | ||||
|                     "unable to wait on child process"); | ||||
|             } | ||||
|             while (processResult == 0 && waitMore(wait)); | ||||
|  | ||||
|             // If the process did not exit then error -- else we may end up with a collection of zombie processes | ||||
|             if (processResult == 0) | ||||
|                 THROW_FMT(ExecuteError, "%s did not exit when expected", strPtr(this->name)); | ||||
|         } | ||||
|         MEM_CONTEXT_TEMP_END(); | ||||
|     } | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -331,7 +368,7 @@ execOpen(Exec *this) | ||||
|     ioWriteOpen(this->ioWriteExec); | ||||
|  | ||||
|     // Set a callback so the handles will get freed | ||||
|     memContextCallbackSet(this->memContext, (MemContextCallback)execFree, this); | ||||
|     memContextCallbackSet(this->memContext, execFreeResource, this); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
| @@ -380,52 +417,3 @@ execMemContext(const Exec *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->memContext); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| execFree(Exec *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(EXEC, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         memContextCallbackClear(this->memContext); | ||||
|  | ||||
|         // Close the io handles | ||||
|         close(this->handleRead); | ||||
|         close(this->handleWrite); | ||||
|         close(this->handleError); | ||||
|  | ||||
|         // Wait for the child to exit. We don't really care how it exits as long as it does. | ||||
|         if (this->processId != 0) | ||||
|         { | ||||
|             MEM_CONTEXT_TEMP_BEGIN() | ||||
|             { | ||||
|                 int processResult = 0; | ||||
|                 Wait *wait = waitNew(this->timeout); | ||||
|  | ||||
|                 do | ||||
|                 { | ||||
|                     THROW_ON_SYS_ERROR( | ||||
|                         (processResult = waitpid(this->processId, NULL, WNOHANG)) == -1, ExecuteError, | ||||
|                         "unable to wait on child process"); | ||||
|                 } | ||||
|                 while (processResult == 0 && waitMore(wait)); | ||||
|  | ||||
|                 // If the process did not exit then error -- else we may end up with a collection of zombie processes | ||||
|                 if (processResult == 0) | ||||
|                     THROW_FMT(ExecuteError, "%s did not exit when expected", strPtr(this->name)); | ||||
|             } | ||||
|             MEM_CONTEXT_TEMP_END(); | ||||
|         } | ||||
|  | ||||
|         // Free mem context | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -12,6 +12,9 @@ execution. | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define EXEC_TYPE                                                   Exec | ||||
| #define EXEC_PREFIX                                                 exec | ||||
|  | ||||
| typedef struct Exec Exec; | ||||
|  | ||||
| #include "common/io/read.h" | ||||
| @@ -27,6 +30,7 @@ Exec *execNew(const String *command, const StringList *param, const String *name | ||||
| Functions | ||||
| ***********************************************************************************************************************************/ | ||||
| void execOpen(Exec *this); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Getters | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -11,9 +11,10 @@ Ini Handler | ||||
| #include "common/memContext.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/type/keyValue.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Contains information about the ini | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| struct Ini | ||||
| { | ||||
| @@ -21,6 +22,8 @@ struct Ini | ||||
|     KeyValue *store;                                                // Key value store that contains the ini data | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(INI); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a new Ini object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -407,19 +410,3 @@ iniMove(Ini *this, MemContext *parentNew) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the ini | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| iniFree(Ini *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(INI, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Ini Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Ini object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INI_TYPE                                                    Ini | ||||
| #define INI_PREFIX                                                  ini | ||||
|  | ||||
| typedef struct Ini Ini; | ||||
|  | ||||
| #include "common/io/write.h" | ||||
|   | ||||
| @@ -49,7 +49,7 @@ Move data from the input buffer to the output buffer | ||||
| static void | ||||
| ioBufferProcess(THIS_VOID, const Buffer *input, Buffer *output) | ||||
| { | ||||
|     THIS(IoBuffer) | ||||
|     THIS(IoBuffer); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(IO_BUFFER, this); | ||||
| @@ -95,7 +95,7 @@ again. | ||||
| static bool | ||||
| ioBufferInputSame(const THIS_VOID) | ||||
| { | ||||
|     THIS(const IoBuffer) | ||||
|     THIS(const IoBuffer); | ||||
|  | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(IO_BUFFER, this); | ||||
|   | ||||
| @@ -7,6 +7,7 @@ IO Filter Interface | ||||
| #include "common/io/filter/filter.intern.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| @@ -19,6 +20,8 @@ struct IoFilter | ||||
|     IoFilterInterface interface;                                    // Filter interface | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(IO_FILTER); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
|  | ||||
| @@ -227,19 +230,3 @@ ioFilterType(const IoFilter *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->type); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| ioFilterFree(IoFilter *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(IO_FILTER, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -14,6 +14,9 @@ Information on implementing a filter is in filter.internal.h. | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define IO_FILTER_TYPE                                              IoFilter | ||||
| #define IO_FILTER_PREFIX                                            ioFilter | ||||
|  | ||||
| typedef struct IoFilter IoFilter; | ||||
|  | ||||
| #include "common/type/string.h" | ||||
|   | ||||
| @@ -12,6 +12,7 @@ IO Filter Group | ||||
| #include "common/io/io.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/list.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -52,6 +53,8 @@ struct IoFilterGroup | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(IO_FILTER_GROUP); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New Object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -432,19 +435,3 @@ ioFilterGroupToLog(const IoFilterGroup *this) | ||||
| { | ||||
|     return strNewFmt("{inputSame: %s, done: %s}", cvtBoolToConstZ(this->inputSame), cvtBoolToConstZ(this->done)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the filter group | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| ioFilterGroupFree(IoFilterGroup *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(IO_FILTER_GROUP, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -13,6 +13,9 @@ only call ioFilterGroupNew(), ioFilterGroupAdd(), and ioFilterGroupResult(). | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define IO_FILTER_GROUP_TYPE                                        IoFilterGroup | ||||
| #define IO_FILTER_GROUP_PREFIX                                      ioFilterGroup | ||||
|  | ||||
| typedef struct IoFilterGroup IoFilterGroup; | ||||
|  | ||||
| #include "common/io/filter/filter.h" | ||||
|   | ||||
| @@ -61,6 +61,8 @@ struct HttpClient | ||||
|     bool contentEof;                                                // Has all content been read? | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(HTTP_CLIENT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Read content | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -497,19 +499,3 @@ httpClientResponseMessage(const HttpClient *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->responseMessage); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| httpClientFree(HttpClient *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(HTTP_CLIENT, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -14,6 +14,9 @@ Only the HTTPS protocol is currently supported. | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define HTTP_CLIENT_TYPE                                            HttpClient | ||||
| #define HTTP_CLIENT_PREFIX                                          httpClient | ||||
|  | ||||
| typedef struct HttpClient HttpClient; | ||||
|  | ||||
| #include "common/io/http/header.h" | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Http Header | ||||
| #include "common/debug.h" | ||||
| #include "common/io/http/header.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/keyValue.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -18,6 +19,8 @@ struct HttpHeader | ||||
|     KeyValue *kv;                                                   // KeyValue store | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(HTTP_HEADER); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -217,19 +220,3 @@ httpHeaderToLog(const HttpHeader *this) | ||||
|  | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| httpHeaderFree(HttpHeader *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(HTTP_HEADER, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,9 @@ Object to track HTTP headers.  Headers can be marked as redacted so they are not | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define HTTP_HEADER_TYPE                                            HttpHeader | ||||
| #define HTTP_HEADER_PREFIX                                          httpHeader | ||||
|  | ||||
| typedef struct HttpHeader HttpHeader; | ||||
|  | ||||
| #include "common/type/stringList.h" | ||||
|   | ||||
| @@ -7,6 +7,7 @@ Http Query | ||||
| #include "common/io/http/common.h" | ||||
| #include "common/io/http/query.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/keyValue.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -18,6 +19,8 @@ struct HttpQuery | ||||
|     KeyValue *kv;                                                   // KeyValue store | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(HTTP_QUERY); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -203,19 +206,3 @@ httpQueryToLog(const HttpQuery *this) | ||||
|  | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| httpQueryFree(HttpQuery *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(HTTP_QUERY, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,9 @@ Object to track HTTP queries and output them with proper escaping. | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define HTTP_QUERY_TYPE                                             HttpQuery | ||||
| #define HTTP_QUERY_PREFIX                                           httpQuery | ||||
|  | ||||
| typedef struct HttpQuery HttpQuery; | ||||
|  | ||||
| #include "common/type/stringList.h" | ||||
|   | ||||
| @@ -10,6 +10,7 @@ IO Read Interface | ||||
| #include "common/io/read.intern.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| @@ -31,6 +32,8 @@ struct IoRead | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(IO_READ); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -422,19 +425,3 @@ ioReadInterface(const IoRead *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(&this->interface); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| ioReadFree(IoRead *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(IO_READ, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -12,6 +12,9 @@ example of an IoRead object is IoBufferRead. | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define IO_READ_TYPE                                                IoRead | ||||
| #define IO_READ_PREFIX                                              ioRead | ||||
|  | ||||
| typedef struct IoRead IoRead; | ||||
|  | ||||
| #include "common/io/filter/group.h" | ||||
|   | ||||
| @@ -48,6 +48,18 @@ struct TlsClient | ||||
|     IoWrite *write;                                                 // Write interface | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(TLS_CLIENT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free connection | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(TLS_CLIENT, LOG, logLevelTrace) | ||||
| { | ||||
|     tlsClientClose(this); | ||||
|     SSL_CTX_free(this->context); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -94,7 +106,7 @@ tlsClientNew( | ||||
|         this->context = SSL_CTX_new(method); | ||||
|         cryptoError(this->context == NULL, "unable to create TLS context"); | ||||
|  | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)tlsClientFree, this); | ||||
|         memContextCallbackSet(this->memContext, tlsClientFreeResource, this); | ||||
|  | ||||
|         // Exclude SSL versions to only allow TLS and also disable compression | ||||
|         SSL_CTX_set_options(this->context, (long)(SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION)); | ||||
| @@ -596,25 +608,3 @@ tlsClientIoWrite(const TlsClient *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->write); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| tlsClientFree(TlsClient *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(TLS_CLIENT, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         tlsClientClose(this); | ||||
|         SSL_CTX_free(this->context); | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -19,6 +19,9 @@ be called directly.  Instead use the read/write interfaces available from tlsCli | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define TLS_CLIENT_TYPE                                             TlsClient | ||||
| #define TLS_CLIENT_PREFIX                                           tlsClient | ||||
|  | ||||
| typedef struct TlsClient TlsClient; | ||||
|  | ||||
| #include "common/io/read.h" | ||||
|   | ||||
| @@ -10,6 +10,7 @@ IO Write Interface | ||||
| #include "common/io/write.intern.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| @@ -29,6 +30,8 @@ struct IoWrite | ||||
| #endif | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(IO_WRITE); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -333,19 +336,3 @@ ioWriteInterface(const IoWrite *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(&this->interface); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| ioWriteFree(IoWrite *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(IO_WRITE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -11,6 +11,9 @@ allocate/open or deallocate/free resources.  An example of an IoWrite object is | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define IO_WRITE_TYPE                                               IoWrite | ||||
| #define IO_WRITE_PREFIX                                             ioWrite | ||||
|  | ||||
| typedef struct IoWrite IoWrite; | ||||
|  | ||||
| #include "common/io/filter/group.h" | ||||
|   | ||||
| @@ -44,7 +44,7 @@ struct MemContext | ||||
|     unsigned int allocListSize;                                     // Size of alloc list (not the actual count of allocations) | ||||
|     unsigned int allocFreeIdx;                                      // Index of first free space in the alloc list | ||||
|  | ||||
|     MemContextCallback callbackFunction;                            // Function to call before the context is freed | ||||
|     void (*callbackFunction)(void *);                               // Function to call before the context is freed | ||||
|     void *callbackArgument;                                         // Argument to pass to callback function | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -28,11 +28,6 @@ Space is reserved for this many allocations when a context is created.  When mor | ||||
| ***********************************************************************************************************************************/ | ||||
| #define MEM_CONTEXT_ALLOC_INITIAL_SIZE                              4 | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Memory context callback function type, useful for casts in memContextCallbackSet() | ||||
| ***********************************************************************************************************************************/ | ||||
| typedef void (*MemContextCallback)(void *callbackArgument); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Memory context management functions | ||||
|  | ||||
| @@ -60,7 +55,7 @@ Use the MEM_CONTEXT*() macros when possible rather than implement error-handling | ||||
| ***********************************************************************************************************************************/ | ||||
| MemContext *memContextNew(const char *name); | ||||
| void memContextMove(MemContext *this, MemContext *parentNew); | ||||
| void memContextCallbackSet(MemContext *this, void (*callbackFunction)(void *), void *callbackArgument); | ||||
| void memContextCallbackSet(MemContext *this, void (*callbackFunction)(void *), void *); | ||||
| void memContextCallbackClear(MemContext *this); | ||||
| MemContext *memContextSwitch(MemContext *this); | ||||
| void memContextFree(MemContext *this); | ||||
|   | ||||
| @@ -1,20 +1,90 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Object Macros | ||||
| Object Helper Macros | ||||
|  | ||||
| Macros to automate definitions of various boilerplate functions and log macros. | ||||
|  | ||||
| Each object should have at least two macros defined it its header file, <OBJECT_NAME>_TYPE and <OBJECT_NAME>_PREFIX.  So if the | ||||
| object type is "Object" the macros would be: | ||||
|  | ||||
| #define OBJECT_TYPE                                                 Object | ||||
| #define OBJECT_PREFIX                                               object | ||||
|  | ||||
| In most cases _PREFIX will be identical to _TYPE except that the first letter is lower-cased.  For commonly used objects (e.g. | ||||
| String) a shorter prefix may be used. | ||||
|  | ||||
| When a macro exists to create a function definition in a C file there is no equivalent macro to create the prototype in the header. | ||||
| The prototype is not repetitious enough to justify a macro and it would only serve to obfuscate the header file. | ||||
| ***********************************************************************************************************************************/ | ||||
| #ifndef COMMON_OBJECT_H | ||||
| #define COMMON_OBJECT_H | ||||
|  | ||||
| #include "common/macro.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Used in function parameter lists to discourage use of the untyped thisVoid parameter, e.g.: | ||||
| Used in interface function parameter lists to discourage use of the untyped thisVoid parameter, e.g.: | ||||
|  | ||||
| size_t bufferRead(THIS_VOID, Buffer *buffer) | ||||
|  | ||||
| This macro should not be used unless the function is assigned to an interface. | ||||
| ***********************************************************************************************************************************/ | ||||
| #define THIS_VOID                                                   void *thisVoid | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a local "this" variable of the correct type from a void parameter. | ||||
| Create a local "this" variable of the correct type from a THIS_VOID parameter | ||||
| ***********************************************************************************************************************************/ | ||||
| #define THIS(type)                                                                                                                 \ | ||||
|     type *this = thisVoid; | ||||
| #define THIS(type)                                                  type *this = thisVoid | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free resource associated with an object that was not allocated by a mem context | ||||
|  | ||||
| Create a callback function intended to be use with memContextCallbackSet() that frees a resource that was allocated by, e.g., a | ||||
| third-party library and not by a mem context.  Don't call memFree() or memContextFree() in this function -- that will be handled | ||||
| when the mem context is freed. | ||||
|  | ||||
| If the object prefix is "object" then the function will be defined as: | ||||
|  | ||||
| static void objectFreeResource(THIS_VOID) | ||||
| ***********************************************************************************************************************************/ | ||||
| #define OBJECT_DEFINE_FREE_RESOURCE_BEGIN(objectMacro, logTypeMacro, logLevelMacro)                                                \ | ||||
|     static void                                                                                                                    \ | ||||
|     GLUE(objectMacro##_PREFIX, FreeResource)(THIS_VOID)                                                                            \ | ||||
|     {                                                                                                                              \ | ||||
|         THIS(objectMacro##_TYPE);                                                                                                  \ | ||||
|                                                                                                                                    \ | ||||
|         FUNCTION_##logTypeMacro##_BEGIN(logLevelMacro);                                                                            \ | ||||
|             FUNCTION_##logTypeMacro##_PARAM(objectMacro, this);                                                                    \ | ||||
|         FUNCTION_##logTypeMacro##_END();                                                                                           \ | ||||
|                                                                                                                                    \ | ||||
|         ASSERT(this != NULL); | ||||
|  | ||||
| #define OBJECT_DEFINE_FREE_RESOURCE_END(logTypeMacro)                                                                              \ | ||||
|         FUNCTION_##logTypeMacro##_RETURN_VOID();                                                                                   \ | ||||
|     } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Define a function used by the caller to dispose of an object that is no longer needed when it would consume significant amounts of | ||||
| memory, e.g. in a loop.  For the most part free does not need to be called explicitly, and in fact should not be since the automatic | ||||
| cleanup is much more efficient. | ||||
|  | ||||
| If the object type/prefix is "Object"/"object" then the function will be defined as: | ||||
|  | ||||
| static void objectFree(Object *this) | ||||
|  | ||||
| Note that this function is externed as there no need for a static free function since the context will be cleaned up automatically | ||||
| by the parent context. | ||||
| ***********************************************************************************************************************************/ | ||||
| #define OBJECT_DEFINE_FREE(objectMacro)                                                                                                   \ | ||||
|     void                                                                                                                           \ | ||||
|     GLUE(objectMacro##_PREFIX, Free)(objectMacro##_TYPE *this)                                                                     \ | ||||
|     {                                                                                                                              \ | ||||
|         FUNCTION_TEST_BEGIN();                                                                                                     \ | ||||
|             FUNCTION_TEST_PARAM(objectMacro, this);                                                                                \ | ||||
|         FUNCTION_TEST_END();                                                                                                       \ | ||||
|                                                                                                                                    \ | ||||
|         if (this != NULL)                                                                                                          \ | ||||
|             memContextFree(this->memContext);                                                                                      \ | ||||
|                                                                                                                                    \ | ||||
|         FUNCTION_TEST_RETURN_VOID();                                                                                               \ | ||||
|     } | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -8,6 +8,7 @@ Regular Expression Handler | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/regExp.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -19,6 +20,17 @@ struct RegExp | ||||
|     regex_t regExp; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(REGEXP); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free regular expression | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(REGEXP, TEST, ) | ||||
| { | ||||
|     regfree(&this->regExp); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(TEST); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Handle errors | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -65,7 +77,7 @@ regExpNew(const String *expression) | ||||
|         } | ||||
|  | ||||
|         // Set free callback to ensure cipher context is freed | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)regExpFree, this); | ||||
|         memContextCallbackSet(this->memContext, regExpFreeResource, this); | ||||
|     } | ||||
|     MEM_CONTEXT_NEW_END(); | ||||
|  | ||||
| @@ -96,27 +108,6 @@ regExpMatch(RegExp *this, const String *string) | ||||
|     FUNCTION_TEST_RETURN(result == 0); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free regular expression | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| regExpFree(RegExp *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(REGEXP, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         regfree(&this->regExp); | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Match a regular expression in one call for brevity | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Regular Expression Handler | ||||
| /*********************************************************************************************************************************** | ||||
| RegExp object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define REGEXP_TYPE                                                 RegExp | ||||
| #define REGEXP_PREFIX                                               regExp | ||||
|  | ||||
| typedef struct RegExp RegExp; | ||||
|  | ||||
| #include "common/type/string.h" | ||||
|   | ||||
| @@ -8,6 +8,7 @@ Buffer Handler | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/type/buffer.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Constant buffers that are generally useful | ||||
| @@ -28,6 +29,8 @@ struct Buffer | ||||
|     MemContext *memContext;                                         // Mem context for dynamic buffers | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(BUFFER); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a new buffer | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -506,19 +509,3 @@ bufToLog(const Buffer *this) | ||||
|  | ||||
|     return result; | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the buffer | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| bufFree(Buffer *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(BUFFER, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Buffer Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Buffer object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define BUFFER_TYPE                                                 Buffer | ||||
| #define BUFFER_PREFIX                                               buf | ||||
|  | ||||
| typedef struct Buffer Buffer; | ||||
|  | ||||
| #include "common/memContext.h" | ||||
|   | ||||
| @@ -7,6 +7,7 @@ Key Value Handler | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/keyValue.h" | ||||
| #include "common/type/list.h" | ||||
| #include "common/type/variantList.h" | ||||
| @@ -26,6 +27,8 @@ struct KeyValue | ||||
|     VariantList *keyList;                                           // List of keys | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(KEY_VALUE); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Contains information about an individual key/value pair | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -374,19 +377,3 @@ kvMove(KeyValue *this, MemContext *parentNew) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the string | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| kvFree(KeyValue *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(KEY_VALUE, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Key Value Handler | ||||
| /*********************************************************************************************************************************** | ||||
| KeyValue object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define KEY_VALUE_TYPE                                              KeyValue | ||||
| #define KEY_VALUE_PREFIX                                            kv | ||||
|  | ||||
| typedef struct KeyValue KeyValue; | ||||
|  | ||||
| #include "common/type/variantList.h" | ||||
|   | ||||
| @@ -10,9 +10,10 @@ List Handler | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/type/list.h" | ||||
| #include "common/object.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Contains information about the list | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| struct List | ||||
| { | ||||
| @@ -23,6 +24,8 @@ struct List | ||||
|     unsigned char *list; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(LIST); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a new list | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -235,19 +238,3 @@ lstToLog(const List *this) | ||||
| { | ||||
|     return strNewFmt("{size: %u}", this->listSize); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the string | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| lstFree(List *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(LIST, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ List Handler | ||||
| /*********************************************************************************************************************************** | ||||
| List object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define LIST_TYPE                                                   List | ||||
| #define LIST_PREFIX                                                 lst | ||||
|  | ||||
| typedef struct List List; | ||||
|  | ||||
| #include "common/memContext.h" | ||||
|   | ||||
| @@ -11,6 +11,7 @@ Xml Handler | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/list.h" | ||||
| #include "common/type/xml.h" | ||||
|  | ||||
| @@ -37,6 +38,8 @@ struct XmlDocument | ||||
|     XmlNode *root; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(XML_DOCUMENT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Error handler | ||||
|  | ||||
| @@ -377,6 +380,15 @@ xmlNodeFree(XmlNode *this) | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free document | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(XML_DOCUMENT, LOG, logLevelTrace) | ||||
| { | ||||
|     xmlFreeDoc(this->xml); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a new document with the specified root node | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -402,7 +414,7 @@ xmlDocumentNew(const String *rootName) | ||||
|         this->xml = xmlNewDoc(BAD_CAST "1.0"); | ||||
|  | ||||
|         // Set callback to ensure xml document is freed | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)xmlDocumentFree, this); | ||||
|         memContextCallbackSet(this->memContext, xmlDocumentFreeResource, this); | ||||
|  | ||||
|         this->root = xmlNodeNew(xmlNewNode(NULL, BAD_CAST strPtr(rootName))); | ||||
|         xmlDocSetRootElement(this->xml, this->root->node); | ||||
| @@ -440,7 +452,7 @@ xmlDocumentNewC(const unsigned char *buffer, size_t bufferSize) | ||||
|             THROW_FMT(FormatError, "invalid xml"); | ||||
|  | ||||
|         // Set callback to ensure xml document is freed | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)xmlDocumentFree, this); | ||||
|         memContextCallbackSet(this->memContext, xmlDocumentFreeResource, this); | ||||
|  | ||||
|         // Get the root node | ||||
|         this->root = xmlNodeNew(xmlDocGetRootElement(this->xml)); | ||||
| @@ -518,24 +530,3 @@ xmlDocumentRoot(const XmlDocument *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->root); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free document | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| xmlDocumentFree(XmlDocument *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(XML_DOCUMENT, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         xmlFreeDoc(this->xml); | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -11,6 +11,9 @@ There are many capabilities of libxml2 that are not exposed here and may need to | ||||
| /*********************************************************************************************************************************** | ||||
| Objects | ||||
| ***********************************************************************************************************************************/ | ||||
| #define XML_DOCUMENT_TYPE                                           XmlDocument | ||||
| #define XML_DOCUMENT_PREFIX                                         xmlDocument | ||||
|  | ||||
| typedef struct XmlDocument XmlDocument; | ||||
| typedef struct XmlNode XmlNode; | ||||
| typedef struct XmlNodeList XmlNodeList; | ||||
|   | ||||
| @@ -6,10 +6,11 @@ Wait Handler | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/wait.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Contains information about the wait handler | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| struct Wait | ||||
| { | ||||
| @@ -20,6 +21,8 @@ struct Wait | ||||
|     TimeMSec beginTime;                                             // Time the wait began (in epoch usec) | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(WAIT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New wait handler | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -106,19 +109,3 @@ waitMore(Wait *this) | ||||
|  | ||||
|     FUNCTION_LOG_RETURN(BOOL, result); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the wait | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| waitFree(Wait *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(WAIT, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Wait Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Wait object | ||||
| ***********************************************************************************************************************************/ | ||||
| #define WAIT_TYPE                                                   Wait | ||||
| #define WAIT_PREFIX                                                 wait | ||||
|  | ||||
| typedef struct Wait Wait; | ||||
|  | ||||
| #include "common/time.h" | ||||
|   | ||||
| @@ -14,6 +14,7 @@ Info Handler | ||||
| #include "common/ini.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/json.h" | ||||
| #include "info/info.h" | ||||
| #include "storage/helper.h" | ||||
| @@ -41,6 +42,8 @@ struct Info | ||||
|     const String *cipherPass;                                       // Cipher passphrase if set | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(INFO); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Generate hash for the contents of an ini file | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -362,19 +365,3 @@ infoCipherPass(const Info *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->cipherPass); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| infoFree(Info *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(INFO, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Info Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_TYPE                                                   Info | ||||
| #define INFO_PREFIX                                                 info | ||||
|  | ||||
| typedef struct Info Info; | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
|   | ||||
| @@ -10,8 +10,9 @@ Archive Info Handler | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "info/infoArchive.h" | ||||
| #include "info/infoPg.h" | ||||
| #include "postgres/interface.h" | ||||
| @@ -27,6 +28,8 @@ struct InfoArchive | ||||
|     String *archiveId;                                              // Archive id for the current PG version | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(INFO_ARCHIVE); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create new object and load contents from a file | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -182,19 +185,3 @@ infoArchivePg(const InfoArchive *this) | ||||
|  | ||||
|     FUNCTION_TEST_RETURN(this->infoPg); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the info | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| infoArchiveFree(InfoArchive *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(INFO_ARCHIVE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Archive Info Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_ARCHIVE_TYPE                                           InfoArchive | ||||
| #define INFO_ARCHIVE_PREFIX                                         infoArchive | ||||
|  | ||||
| typedef struct InfoArchive InfoArchive; | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
|   | ||||
| @@ -9,9 +9,10 @@ Backup Info Handler | ||||
| #include <inttypes.h> | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/list.h" | ||||
| #include "info/info.h" | ||||
| @@ -44,6 +45,8 @@ struct InfoBackup | ||||
|     List *backup;                                                   // List of current backups and their associated data | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(INFO_BACKUP); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create new object and load contents from a file | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -316,19 +319,3 @@ infoBackupDataToLog(const InfoBackupData *this) | ||||
| { | ||||
|     return strNewFmt("{label: %s, pgId: %u}", strPtr(this->backupLabel), this->backupPgId); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the info | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| infoBackupFree(InfoBackup *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(INFO_BACKUP, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Backup Info Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_BACKUP_TYPE                                            InfoBackup | ||||
| #define INFO_BACKUP_PREFIX                                          infoBackup | ||||
|  | ||||
| typedef struct InfoBackup InfoBackup; | ||||
|  | ||||
| #include "common/type/string.h" | ||||
|   | ||||
| @@ -9,10 +9,10 @@ PostgreSQL Info Handler | ||||
| #include <string.h> | ||||
|  | ||||
| #include "common/debug.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/list.h" | ||||
| #include "info/info.h" | ||||
| @@ -44,6 +44,8 @@ struct InfoPg | ||||
|     unsigned int historyCurrent;                                    // Index of the current history item | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(INFO_PG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create new object and load contents from a file | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -330,19 +332,3 @@ infoPgDataToLog(const InfoPgData *this) | ||||
|         "{id: %u, version: %u, systemId: %" PRIu64 ", catalogVersion: %" PRIu32 ", controlVersion: %" PRIu32 "}", | ||||
|         this->id, this->version, this->systemId, this->catalogVersion, this->controlVersion); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the info | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| infoPgFree(InfoPg *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(INFO_PG, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ PostgreSQL Info Handler | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_PG_TYPE                                                InfoPg | ||||
| #define INFO_PG_PREFIX                                              infoPg | ||||
|  | ||||
| typedef struct InfoPg InfoPg; | ||||
|  | ||||
| #include <stdint.h> | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Protocol Client | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/time.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/keyValue.h" | ||||
| @@ -40,6 +41,22 @@ struct ProtocolClient | ||||
|     TimeMSec keepAliveTime; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(PROTOCOL_CLIENT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close protocol connection | ||||
| ***********************************************************************************************************************************/ | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(PROTOCOL_CLIENT, LOG, logLevelTrace) | ||||
| { | ||||
|     // Send an exit command but don't wait to see if it succeeds | ||||
|     MEM_CONTEXT_TEMP_BEGIN() | ||||
|     { | ||||
|         protocolClientWriteCommand(this, protocolCommandNew(PROTOCOL_COMMAND_EXIT_STR)); | ||||
|     } | ||||
|     MEM_CONTEXT_TEMP_END(); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -110,7 +127,7 @@ protocolClientNew(const String *name, const String *service, IoRead *read, IoWri | ||||
|         protocolClientNoOp(this); | ||||
|  | ||||
|         // Set a callback to shutdown the protocol | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)protocolClientFree, this); | ||||
|         memContextCallbackSet(this->memContext, protocolClientFreeResource, this); | ||||
|     } | ||||
|     MEM_CONTEXT_NEW_END(); | ||||
|  | ||||
| @@ -295,30 +312,3 @@ protocolClientToLog(const ProtocolClient *this) | ||||
| { | ||||
|     return strNewFmt("{name: %s}", strPtr(this->name)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| protocolClientFree(ProtocolClient *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(PROTOCOL_CLIENT, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         memContextCallbackClear(this->memContext); | ||||
|  | ||||
|         // Send an exit command but don't wait to see if it succeeds | ||||
|         MEM_CONTEXT_TEMP_BEGIN() | ||||
|         { | ||||
|             protocolClientWriteCommand(this, protocolCommandNew(PROTOCOL_COMMAND_EXIT_STR)); | ||||
|         } | ||||
|         MEM_CONTEXT_TEMP_END(); | ||||
|  | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Protocol Client | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define PROTOCOL_CLIENT_TYPE                                        ProtocolClient | ||||
| #define PROTOCOL_CLIENT_PREFIX                                      protocolClient | ||||
|  | ||||
| typedef struct ProtocolClient ProtocolClient; | ||||
|  | ||||
| #include "common/io/read.h" | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Protocol Command | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/keyValue.h" | ||||
| #include "protocol/command.h" | ||||
| @@ -26,6 +27,8 @@ struct ProtocolCommand | ||||
|     Variant *parameterList; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(PROTOCOL_COMMAND); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -136,19 +139,3 @@ protocolCommandToLog(const ProtocolCommand *this) | ||||
| { | ||||
|     return strNewFmt("{command: %s}", strPtr(this->command)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| protocolCommandFree(ProtocolCommand *this) | ||||
| { | ||||
|     FUNCTION_TEST_BEGIN(); | ||||
|         FUNCTION_TEST_PARAM(PROTOCOL_COMMAND, this); | ||||
|     FUNCTION_TEST_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_TEST_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Protocol Command | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define PROTOCOL_COMMAND_TYPE                                       ProtocolCommand | ||||
| #define PROTOCOL_COMMAND_PREFIX                                     protocolCommand | ||||
|  | ||||
| typedef struct ProtocolCommand ProtocolCommand; | ||||
|  | ||||
| #include "common/type/variant.h" | ||||
|   | ||||
| @@ -9,6 +9,7 @@ Protocol Parallel Executor | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/keyValue.h" | ||||
| #include "common/type/list.h" | ||||
| @@ -31,6 +32,8 @@ struct ProtocolParallel | ||||
|     ProtocolParallelJobState state;                                 // Overall state of job processing | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(PROTOCOL_PARALLEL); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -286,19 +289,3 @@ protocolParallelToLog(const ProtocolParallel *this) | ||||
|         "{state: %s, clientTotal: %u, jobTotal: %u}", protocolParallelJobToConstZ(this->state), lstSize(this->clientList), | ||||
|         lstSize(this->jobList)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| protocolParallelFree(ProtocolParallel *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(PROTOCOL_PARALLEL, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Protocol Parallel Executor | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define PROTOCOL_PARALLEL_TYPE                                      ProtocolParallel | ||||
| #define PROTOCOL_PARALLEL_PREFIX                                    protocolParallel | ||||
|  | ||||
| typedef struct ProtocolParallel ProtocolParallel; | ||||
|  | ||||
| #include "common/time.h" | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Protocol Parallel Job | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "protocol/command.h" | ||||
| #include "protocol/parallelJob.h" | ||||
|  | ||||
| @@ -26,6 +27,8 @@ struct ProtocolParallelJob | ||||
|     const Variant *result;                                          // Result if job was successful | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(PROTOCOL_PARALLEL_JOB); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -297,19 +300,3 @@ protocolParallelJobToLog(const ProtocolParallelJob *this) | ||||
|         strPtr(varToLog(this->key)), strPtr(protocolCommandToLog(this->command)), this->code, strPtr(strToLog(this->message)), | ||||
|         strPtr(varToLog(this->result))); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| protocolParallelJobFree(ProtocolParallelJob *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(PROTOCOL_PARALLEL_JOB, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Protocol Parallel Job | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define PROTOCOL_PARALLEL_JOB_TYPE                                  ProtocolParallelJob | ||||
| #define PROTOCOL_PARALLEL_JOB_PREFIX                                protocolParallelJob | ||||
|  | ||||
| typedef struct ProtocolParallelJob ProtocolParallelJob; | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
|   | ||||
| @@ -8,6 +8,7 @@ Protocol Server | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/time.h" | ||||
| #include "common/type/json.h" | ||||
| #include "common/type/keyValue.h" | ||||
| @@ -29,6 +30,8 @@ struct ProtocolServer | ||||
|     List *handlerList; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(PROTOCOL_SERVER); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -265,19 +268,3 @@ protocolServerToLog(const ProtocolServer *this) | ||||
| { | ||||
|     return strNewFmt("{name: %s}", strPtr(this->name)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| protocolServerFree(ProtocolServer *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(PROTOCOL_SERVER, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Protocol Server | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define PROTOCOL_SERVER_TYPE                                        ProtocolServer | ||||
| #define PROTOCOL_SERVER_PREFIX                                      protocolServer | ||||
|  | ||||
| typedef struct ProtocolServer ProtocolServer; | ||||
|  | ||||
| #include "common/io/read.h" | ||||
|   | ||||
| @@ -19,6 +19,9 @@ Posix Storage Read | ||||
| /*********************************************************************************************************************************** | ||||
| Object types | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_READ_POSIX_TYPE                                     StorageReadPosix | ||||
| #define STORAGE_READ_POSIX_PREFIX                                   storageReadPosix | ||||
|  | ||||
| typedef struct StorageReadPosix | ||||
| { | ||||
|     MemContext *memContext;                                         // Object mem context | ||||
| @@ -38,51 +41,14 @@ Macros for function logging | ||||
|     objToLog(value, "StorageReadPosix", buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| Close the file handle | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageReadPosixClose(THIS_VOID) | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(STORAGE_READ_POSIX, LOG, logLevelTrace) | ||||
| { | ||||
|     THIS(StorageReadPosix); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     // Close if the file has not already been closed | ||||
|     if (this->handle != -1) | ||||
|     { | ||||
|         // Close the file | ||||
|         storagePosixFileClose(this->handle, this->interface.name, true); | ||||
|  | ||||
|         this->handle = -1; | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the object | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageReadPosixFree(StorageReadPosix *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         storageReadPosixClose(this); | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Open the file | ||||
| @@ -107,7 +73,7 @@ storageReadPosixOpen(THIS_VOID) | ||||
|     // On success set free callback to ensure file handle is freed | ||||
|     if (this->handle != -1) | ||||
|     { | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)storageReadPosixFree, this); | ||||
|         memContextCallbackSet(this->memContext, storageReadPosixFreeResource, this); | ||||
|         result = true; | ||||
|     } | ||||
|  | ||||
| @@ -156,6 +122,27 @@ storageReadPosix(THIS_VOID, Buffer *buffer, bool block) | ||||
|     FUNCTION_LOG_RETURN(SIZE, (size_t)actualBytes); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageReadPosixClose(THIS_VOID) | ||||
| { | ||||
|     THIS(StorageReadPosix); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_READ_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     storageReadPosixFreeResource(this); | ||||
|     memContextCallbackClear(this->memContext); | ||||
|     this->handle = -1; | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Has file reached EOF? | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -218,6 +205,7 @@ storageReadPosixNew(StoragePosix *storage, const String *name, bool ignoreMissin | ||||
|  | ||||
|             .ioInterface = (IoReadInterface) | ||||
|             { | ||||
|                 .close = storageReadPosixClose, | ||||
|                 .eof = storageReadPosixEof, | ||||
|                 .handle = storageReadPosixHandle, | ||||
|                 .open = storageReadPosixOpen, | ||||
|   | ||||
| @@ -23,6 +23,9 @@ Posix Storage File write | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_WRITE_POSIX_TYPE                                    StorageWritePosix | ||||
| #define STORAGE_WRITE_POSIX_PREFIX                                  storageWritePosix | ||||
|  | ||||
| typedef struct StorageWritePosix | ||||
| { | ||||
|     MemContext *memContext;                                         // Object mem context | ||||
| @@ -51,85 +54,14 @@ Since open is called more than once use constants to make sure these parameters | ||||
| #define FILE_OPEN_PURPOSE                                           "write" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| Close file handle | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWritePosixClose(THIS_VOID) | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(STORAGE_WRITE_POSIX, LOG, logLevelTrace) | ||||
| { | ||||
|     THIS(StorageWritePosix); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     // Close if the file has not already been closed | ||||
|     if (this->handle != -1) | ||||
|     { | ||||
|         // Sync the file | ||||
|         if (this->interface.syncFile) | ||||
|             storagePosixFileSync(this->handle, this->nameTmp, true, false); | ||||
|  | ||||
|         // Close the file | ||||
|         storagePosixFileClose(this->handle, this->nameTmp, true); | ||||
|  | ||||
|         // Update modified time | ||||
|         if (this->interface.timeModified != 0) | ||||
|         { | ||||
|             THROW_ON_SYS_ERROR_FMT( | ||||
|                 utime( | ||||
|                     strPtr(this->nameTmp), | ||||
|                     &((struct utimbuf){.actime = this->interface.timeModified, .modtime = this->interface.timeModified})) == -1, | ||||
|                 FileInfoError, "unable to set time for '%s'", strPtr(this->nameTmp)); | ||||
|         } | ||||
|  | ||||
|         // Rename from temp file | ||||
|         if (this->interface.atomic) | ||||
|         { | ||||
|             if (rename(strPtr(this->nameTmp), strPtr(this->interface.name)) == -1) | ||||
|             { | ||||
|                 THROW_SYS_ERROR_FMT( | ||||
|                     FileMoveError, "unable to move '%s' to '%s'", strPtr(this->nameTmp), strPtr(this->interface.name)); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // Sync the path | ||||
|         if (this->interface.syncPath) | ||||
|             storagePosixPathSync(this->storage, this->path, false); | ||||
|  | ||||
|         // This marks the file as closed | ||||
|         this->handle = -1; | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWritePosixFree(StorageWritePosix *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         memContextCallbackClear(this->memContext); | ||||
|  | ||||
|         // Close the temp file.  *Close() must be called explicitly in order for the file to be sycn'ed, renamed, etc.  If *Free() | ||||
|         // is called first the assumption is that some kind of error occurred and we should only close the handle to free | ||||
|         // resources. | ||||
|         if (this->handle != -1) | ||||
|             storagePosixFileClose(this->handle, this->interface.name, true); | ||||
|  | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
|         storagePosixFileClose(this->handle, this->interface.name, true); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Open the file | ||||
| @@ -162,7 +94,7 @@ storageWritePosixOpen(THIS_VOID) | ||||
|     } | ||||
|  | ||||
|     // Set free callback to ensure file handle is freed | ||||
|     memContextCallbackSet(this->memContext, (MemContextCallback)storageWritePosixFree, this); | ||||
|     memContextCallbackSet(this->memContext, storageWritePosixFreeResource, this); | ||||
|  | ||||
|     // Update user/group owner | ||||
|     if (this->interface.user != NULL || this->interface.group != NULL) | ||||
| @@ -218,6 +150,60 @@ storageWritePosix(THIS_VOID, const Buffer *buffer) | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWritePosixClose(THIS_VOID) | ||||
| { | ||||
|     THIS(StorageWritePosix); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_POSIX, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     // Close if the file has not already been closed | ||||
|     if (this->handle != -1) | ||||
|     { | ||||
|         // Sync the file | ||||
|         if (this->interface.syncFile) | ||||
|             storagePosixFileSync(this->handle, this->nameTmp, true, false); | ||||
|  | ||||
|         // Close the file | ||||
|         storagePosixFileClose(this->handle, this->nameTmp, true); | ||||
|         memContextCallbackClear(this->memContext); | ||||
|         this->handle = -1; | ||||
|  | ||||
|         // Update modified time | ||||
|         if (this->interface.timeModified != 0) | ||||
|         { | ||||
|             THROW_ON_SYS_ERROR_FMT( | ||||
|                 utime( | ||||
|                     strPtr(this->nameTmp), | ||||
|                     &((struct utimbuf){.actime = this->interface.timeModified, .modtime = this->interface.timeModified})) == -1, | ||||
|                 FileInfoError, "unable to set time for '%s'", strPtr(this->nameTmp)); | ||||
|         } | ||||
|  | ||||
|         // Rename from temp file | ||||
|         if (this->interface.atomic) | ||||
|         { | ||||
|             if (rename(strPtr(this->nameTmp), strPtr(this->interface.name)) == -1) | ||||
|             { | ||||
|                 THROW_SYS_ERROR_FMT( | ||||
|                     FileMoveError, "unable to move '%s' to '%s'", strPtr(this->nameTmp), strPtr(this->interface.name)); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // Sync the path | ||||
|         if (this->interface.syncPath) | ||||
|             storagePosixPathSync(this->storage, this->path, false); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Get handle (file descriptor) | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Storage Read Interface | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "storage/read.intern.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -19,6 +20,8 @@ struct StorageRead | ||||
|     IoRead *io; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(STORAGE_READ); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macros for function logging | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -157,19 +160,3 @@ storageReadToLog(const StorageRead *this) | ||||
|         "{type: %s, name: %s, ignoreMissing: %s}", strPtr(this->interface->type), strPtr(strToLog(this->interface->name)), | ||||
|         cvtBoolToConstZ(this->interface->ignoreMissing)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the file | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| storageReadFree(const StorageRead *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_READ, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Storage Read Interface | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_READ_TYPE                                           StorageRead | ||||
| #define STORAGE_READ_PREFIX                                         storageRead | ||||
|  | ||||
| typedef struct StorageRead StorageRead; | ||||
|  | ||||
| #include "common/io/read.h" | ||||
| @@ -27,7 +30,7 @@ const String *storageReadType(const StorageRead *this); | ||||
| /*********************************************************************************************************************************** | ||||
| Destructor | ||||
| ***********************************************************************************************************************************/ | ||||
| void storageReadFree(const StorageRead *this); | ||||
| void storageReadFree(StorageRead *this); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macros for function logging | ||||
|   | ||||
| @@ -23,7 +23,7 @@ typedef struct StorageReadRemote | ||||
| { | ||||
|     MemContext *memContext;                                         // Object mem context | ||||
|     StorageReadInterface interface;                                 // Interface | ||||
|     StorageRemote *storage;                                   // Storage that created this object | ||||
|     StorageRemote *storage;                                         // Storage that created this object | ||||
|  | ||||
|     ProtocolClient *client;                                         // Protocol client for requests | ||||
|     size_t remaining;                                               // Bytes remaining to be read in block | ||||
|   | ||||
| @@ -285,9 +285,8 @@ storageRemoteNew( | ||||
|  | ||||
|         this = storageNewP( | ||||
|             STORAGE_REMOTE_TYPE_STR, NULL, modeFile, modePath, write, pathExpressionFunction, driver, | ||||
|             .exists = storageRemoteExists, .info = storageRemoteInfo, .list = storageRemoteList, | ||||
|             .newRead = storageRemoteNewRead, .newWrite = storageRemoteNewWrite, | ||||
|             .pathCreate = storageRemotePathCreate, .pathRemove = storageRemotePathRemove, | ||||
|             .exists = storageRemoteExists, .info = storageRemoteInfo, .list = storageRemoteList, .newRead = storageRemoteNewRead, | ||||
|             .newWrite = storageRemoteNewWrite, .pathCreate = storageRemotePathCreate, .pathRemove = storageRemotePathRemove, | ||||
|             .pathSync = storageRemotePathSync, .remove = storageRemoteRemove); | ||||
|     } | ||||
|     MEM_CONTEXT_NEW_END(); | ||||
|   | ||||
| @@ -15,11 +15,14 @@ Remote Storage File write | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_WRITE_REMOTE_TYPE                                   StorageWriteRemote | ||||
| #define STORAGE_WRITE_REMOTE_PREFIX                                 storageWriteRemote | ||||
|  | ||||
| typedef struct StorageWriteRemote | ||||
| { | ||||
|     MemContext *memContext;                                         // Object mem context | ||||
|     StorageWriteInterface interface;                                // Interface | ||||
|     StorageRemote *storage;                                   // Storage that created this object | ||||
|     StorageRemote *storage;                                         // Storage that created this object | ||||
|     ProtocolClient *client;                                         // Protocol client to make requests with | ||||
| } StorageWriteRemote; | ||||
|  | ||||
| @@ -32,61 +35,15 @@ Macros for function logging | ||||
|     objToLog(value, "StorageWriteRemote", buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| Close file on the remote | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWriteRemoteClose(THIS_VOID) | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(STORAGE_WRITE_REMOTE, LOG, logLevelTrace) | ||||
| { | ||||
|     THIS(StorageWriteRemote); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     // Close if the file has not already been closed | ||||
|     if (this->client != NULL) | ||||
|     { | ||||
|         ioWriteLine(protocolClientIoWrite(this->client), BUFSTRDEF(PROTOCOL_BLOCK_HEADER "0")); | ||||
|         ioWriteFlush(protocolClientIoWrite(this->client)); | ||||
|         protocolClientReadOutput(this->client, false); | ||||
|  | ||||
|         this->client = NULL; | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the file | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWriteRemoteFree(StorageWriteRemote *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|     { | ||||
|         memContextCallbackClear(this->memContext); | ||||
|  | ||||
|         // If freed without closing then notify the remote to close the file | ||||
|         if (this->client != NULL) | ||||
|         { | ||||
|             ioWriteLine(protocolClientIoWrite(this->client), BUFSTRDEF(PROTOCOL_BLOCK_HEADER "-1")); | ||||
|             ioWriteFlush(protocolClientIoWrite(this->client)); | ||||
|             protocolClientReadOutput(this->client, false); | ||||
|  | ||||
|             this->client = NULL; | ||||
|         } | ||||
|  | ||||
|         memContextFree(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
|     ioWriteLine(protocolClientIoWrite(this->client), BUFSTRDEF(PROTOCOL_BLOCK_HEADER "-1")); | ||||
|     ioWriteFlush(protocolClientIoWrite(this->client)); | ||||
|     protocolClientReadOutput(this->client, false); | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Open the file | ||||
| @@ -119,7 +76,7 @@ storageWriteRemoteOpen(THIS_VOID) | ||||
|         protocolClientExecute(this->client, command, false); | ||||
|  | ||||
|         // Set free callback to ensure remote file is freed | ||||
|         memContextCallbackSet(this->memContext, (MemContextCallback)storageWriteRemoteFree, this); | ||||
|         memContextCallbackSet(this->memContext, storageWriteRemoteFreeResource, this); | ||||
|     } | ||||
|     MEM_CONTEXT_TEMP_END(); | ||||
|  | ||||
| @@ -149,6 +106,34 @@ storageWriteRemote(THIS_VOID, const Buffer *buffer) | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Close the file | ||||
| ***********************************************************************************************************************************/ | ||||
| static void | ||||
| storageWriteRemoteClose(THIS_VOID) | ||||
| { | ||||
|     THIS(StorageWriteRemote); | ||||
|  | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE_REMOTE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     ASSERT(this != NULL); | ||||
|  | ||||
|     // Close if the file has not already been closed | ||||
|     if (this->client != NULL) | ||||
|     { | ||||
|         ioWriteLine(protocolClientIoWrite(this->client), BUFSTRDEF(PROTOCOL_BLOCK_HEADER "0")); | ||||
|         ioWriteFlush(protocolClientIoWrite(this->client)); | ||||
|         protocolClientReadOutput(this->client, false); | ||||
|         this->client = NULL; | ||||
|  | ||||
|         memContextCallbackClear(this->memContext); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Create a new file | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -758,9 +758,9 @@ storageS3New( | ||||
|  | ||||
|         this = storageNewP( | ||||
|             STORAGE_S3_TYPE_STR, path, 0, 0, write, pathExpressionFunction, driver, | ||||
|             .exists = storageS3Exists, .info = storageS3Info, .list = storageS3List, | ||||
|             .newRead = storageS3NewRead, .newWrite = storageS3NewWrite, .pathCreate = storageS3PathCreate, | ||||
|             .pathRemove = storageS3PathRemove, .pathSync = storageS3PathSync, .remove = storageS3Remove); | ||||
|             .exists = storageS3Exists, .info = storageS3Info, .list = storageS3List, .newRead = storageS3NewRead, | ||||
|             .newWrite = storageS3NewWrite, .pathCreate = storageS3PathCreate, .pathRemove = storageS3PathRemove, | ||||
|             .pathSync = storageS3PathSync, .remove = storageS3Remove); | ||||
|     } | ||||
|     MEM_CONTEXT_NEW_END(); | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ typedef struct StorageWriteS3 | ||||
| { | ||||
|     MemContext *memContext;                                         // Object mem context | ||||
|     StorageWriteInterface interface;                                // Interface | ||||
|     StorageS3 *storage;                                       // Storage that created this object | ||||
|     StorageS3 *storage;                                             // Storage that created this object | ||||
|  | ||||
|     size_t partSize; | ||||
|     Buffer *partBuffer; | ||||
|   | ||||
| @@ -10,6 +10,7 @@ Storage Interface | ||||
| #include "common/io/io.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "common/wait.h" | ||||
| #include "storage/storage.intern.h" | ||||
|  | ||||
| @@ -31,6 +32,8 @@ struct Storage | ||||
|     StoragePathExpressionCallback pathExpressionFunction; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(STORAGE); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New storage object | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -723,19 +726,3 @@ storageToLog(const Storage *this) | ||||
|     return strNewFmt( | ||||
|         "{type: %s, path: %s, write: %s}", strPtr(this->type), strPtr(strToLog(this->path)), cvtBoolToConstZ(this->write)); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free storage | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| storageFree(const Storage *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelDebug); | ||||
|         FUNCTION_LOG_PARAM(STORAGE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,9 @@ Storage Interface | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_TYPE                                                Storage | ||||
| #define STORAGE_PREFIX                                              storage | ||||
|  | ||||
| typedef struct Storage Storage; | ||||
|  | ||||
| #include "common/type/buffer.h" | ||||
|   | ||||
| @@ -6,6 +6,7 @@ Storage Write Interface | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/object.h" | ||||
| #include "storage/write.intern.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| @@ -19,6 +20,8 @@ struct StorageWrite | ||||
|     IoWrite *io; | ||||
| }; | ||||
|  | ||||
| OBJECT_DEFINE_FREE(STORAGE_WRITE); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macros for function logging | ||||
| ***********************************************************************************************************************************/ | ||||
| @@ -238,19 +241,3 @@ storageWriteToLog(const StorageWrite *this) | ||||
|         storageWriteModePath(this), cvtBoolToConstZ(storageWriteCreatePath(this)), cvtBoolToConstZ(storageWriteSyncFile(this)), | ||||
|         cvtBoolToConstZ(storageWriteSyncPath(this)), cvtBoolToConstZ(storageWriteAtomic(this))); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free the file | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| storageWriteFree(const StorageWrite *this) | ||||
| { | ||||
|     FUNCTION_LOG_BEGIN(logLevelTrace); | ||||
|         FUNCTION_LOG_PARAM(STORAGE_WRITE, this); | ||||
|     FUNCTION_LOG_END(); | ||||
|  | ||||
|     if (this != NULL) | ||||
|         memContextFree(this->memContext); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN_VOID(); | ||||
| } | ||||
|   | ||||
| @@ -7,6 +7,9 @@ Storage Write Interface | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define STORAGE_WRITE_TYPE                                          StorageWrite | ||||
| #define STORAGE_WRITE_PREFIX                                        storageWrite | ||||
|  | ||||
| typedef struct StorageWrite StorageWrite; | ||||
|  | ||||
| #include "common/io/write.h" | ||||
| @@ -34,7 +37,7 @@ const String *storageWriteType(const StorageWrite *this); | ||||
| /*********************************************************************************************************************************** | ||||
| Destructor | ||||
| ***********************************************************************************************************************************/ | ||||
| void storageWriteFree(const StorageWrite *this); | ||||
| void storageWriteFree(StorageWrite *this); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macros for function logging | ||||
|   | ||||
| @@ -118,6 +118,13 @@ unit: | ||||
|         coverage: | ||||
|           common/debug: full | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: object | ||||
|         total: 1 | ||||
|  | ||||
|         coverage: | ||||
|           common/object: noCode | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: lock | ||||
|         total: 2 | ||||
|   | ||||
| @@ -37,7 +37,7 @@ testCompress(IoFilter *compress, Buffer *decompressed, size_t inputSize, size_t | ||||
|     } | ||||
|  | ||||
|     ioWriteClose(write); | ||||
|     gzipCompressFree(ioFilterDriver(compress)); | ||||
|     memContextFree(((GzipCompress *)ioFilterDriver(compress))->memContext); | ||||
|  | ||||
|     return compressed; | ||||
| } | ||||
| @@ -67,7 +67,7 @@ testDecompress(IoFilter *decompress, Buffer *compressed, size_t inputSize, size_ | ||||
|  | ||||
|     ioReadClose(read); | ||||
|     bufFree(output); | ||||
|     gzipDecompressFree(ioFilterDriver(decompress)); | ||||
|     memContextFree(((GzipDecompress *)ioFilterDriver(decompress))->memContext); | ||||
|  | ||||
|     return decompressed; | ||||
| } | ||||
| @@ -155,10 +155,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL( | ||||
|             bufEq(decompressed, testDecompress(gzipDecompressNew(true), compressed, bufSize(compressed), 1024 * 256)), true, | ||||
|             "zero data - decompress large in/small out buffer"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(gzipCompressFree(NULL), "free null decompress object"); | ||||
|         TEST_RESULT_VOID(gzipDecompressFree(NULL), "free null decompress object"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
| @@ -171,8 +167,6 @@ testRun(void) | ||||
|         decompress->inputSame = true; | ||||
|         decompress->done = true; | ||||
|         TEST_RESULT_STR(strPtr(gzipDecompressToLog(decompress)), "{inputSame: true, done: true, availIn: 0}", "format object"); | ||||
|  | ||||
|         gzipDecompressFree(decompress); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
|   | ||||
| @@ -99,9 +99,6 @@ testRun(void) | ||||
|         TEST_RESULT_PTR_NE(cipherBlock->digest, NULL, "digest is set"); | ||||
|         TEST_RESULT_PTR(cipherBlock->cipherContext, NULL, "cipher context is not set"); | ||||
|  | ||||
|         TEST_RESULT_VOID(cipherBlockFree(cipherBlock), "free cipher block"); | ||||
|         TEST_RESULT_VOID(cipherBlockFree(NULL), "free null cipher block"); | ||||
|  | ||||
|         // Encrypt | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         Buffer *encryptBuffer = bufNew(TEST_BUFFER_SIZE); | ||||
| @@ -150,7 +147,7 @@ testRun(void) | ||||
|             "cipher size increases by one block on flush"); | ||||
|         TEST_RESULT_BOOL(ioFilterDone(blockEncryptFilter), true,  "filter is done"); | ||||
|  | ||||
|         cipherBlockFree(blockEncrypt); | ||||
|         ioFilterFree(blockEncryptFilter); | ||||
|  | ||||
|         // Decrypt in one pass | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -171,7 +168,7 @@ testRun(void) | ||||
|  | ||||
|         TEST_RESULT_STR(strPtr(strNewBuf(decryptBuffer)), TEST_PLAINTEXT TEST_PLAINTEXT, "check final decrypt buffer"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // Decrypt in small chunks to test buffering | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -211,7 +208,7 @@ testRun(void) | ||||
|  | ||||
|         TEST_RESULT_STR(strPtr(strNewBuf(decryptBuffer)), TEST_PLAINTEXT TEST_PLAINTEXT, "check final decrypt buffer"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // Encrypt zero byte file and decrypt it | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -223,7 +220,7 @@ testRun(void) | ||||
|         ioFilterProcessInOut(blockEncryptFilter, NULL, encryptBuffer); | ||||
|         TEST_RESULT_INT(bufUsed(encryptBuffer), 32, "check remaining size"); | ||||
|  | ||||
|         cipherBlockFree(blockEncrypt); | ||||
|         ioFilterFree(blockEncryptFilter); | ||||
|  | ||||
|         blockDecryptFilter = cipherBlockNew(cipherModeDecrypt, cipherTypeAes256Cbc, testPass, NULL); | ||||
|         blockDecrypt = (CipherBlock *)ioFilterDriver(blockDecryptFilter); | ||||
| @@ -235,7 +232,7 @@ testRun(void) | ||||
|         ioFilterProcessInOut(blockDecryptFilter, NULL, decryptBuffer); | ||||
|         TEST_RESULT_INT(bufUsed(decryptBuffer), 0, "0 bytes on flush"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // Invalid cipher header | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -246,7 +243,7 @@ testRun(void) | ||||
|             ioFilterProcessInOut(blockDecryptFilter, BUFSTRDEF("1234567890123456"), decryptBuffer), CryptoError, | ||||
|             "cipher header invalid"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // Invalid encrypted data cannot be flushed | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -260,7 +257,7 @@ testRun(void) | ||||
|  | ||||
|         TEST_ERROR(ioFilterProcessInOut(blockDecryptFilter, NULL, decryptBuffer), CryptoError, "unable to flush"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // File with no header should not flush | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -271,7 +268,7 @@ testRun(void) | ||||
|  | ||||
|         TEST_ERROR(ioFilterProcessInOut(blockDecryptFilter, NULL, decryptBuffer), CryptoError, "cipher header missing"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|  | ||||
|         // File with header only should error | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -283,7 +280,7 @@ testRun(void) | ||||
|         ioFilterProcessInOut(blockDecryptFilter, BUFSTRDEF(CIPHER_BLOCK_MAGIC "12345678"), decryptBuffer); | ||||
|         TEST_ERROR(ioFilterProcessInOut(blockDecryptFilter, NULL, decryptBuffer), CryptoError, "unable to flush"); | ||||
|  | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|         ioFilterFree(blockDecryptFilter); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|   | ||||
| @@ -89,7 +89,7 @@ testRun(void) | ||||
|         TEST_ASSIGN(exec, execNew(strNew("sleep"), strLstAddZ(strLstNew(), "2"), strNew("sleep"), 1000), "new sleep exec"); | ||||
|         TEST_RESULT_VOID(execOpen(exec), "open cat exec"); | ||||
|  | ||||
|         TEST_ERROR(execFree(exec), ExecuteError, "sleep did not exit when expected"); | ||||
|         TEST_ERROR(execFreeResource(exec), ExecuteError, "sleep did not exit when expected"); | ||||
|  | ||||
|         TEST_ERROR(ioReadLine(execIoRead(exec)), FileReadError, "unable to select from sleep read: [9] Bad file descriptor"); | ||||
|         ioWriteStrLine(execIoWrite(exec), strNew("")); | ||||
| @@ -97,7 +97,6 @@ testRun(void) | ||||
|  | ||||
|         sleepMSec(500); | ||||
|         TEST_RESULT_VOID(execFree(exec), "sleep exited as expected"); | ||||
|         TEST_RESULT_VOID(execFree(NULL), "free null exec"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
|   | ||||
| @@ -23,7 +23,6 @@ testRun(void) | ||||
|         TEST_RESULT_PTR_NE(ini->memContext, NULL, "mem context is set"); | ||||
|         TEST_RESULT_PTR_NE(ini->store, NULL, "store is set"); | ||||
|         TEST_RESULT_VOID(iniFree(ini), "free ini"); | ||||
|         TEST_RESULT_VOID(iniFree(NULL), "free null ini"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|   | ||||
| @@ -319,7 +319,6 @@ testRun(void) | ||||
|         TEST_RESULT_STR(strPtr(httpHeaderToLog(header)), "{key1: 'value1', key2: 'value2a'}", "log output"); | ||||
|  | ||||
|         TEST_RESULT_VOID(httpHeaderFree(header), "free header"); | ||||
|         TEST_RESULT_VOID(httpHeaderFree(NULL), "free null header"); | ||||
|  | ||||
|         // Redacted headers | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -373,7 +372,6 @@ testRun(void) | ||||
|         TEST_RESULT_STR(strPtr(httpQueryToLog(query)), "{key1: 'value 1?', key2: 'value2a'}", "log output"); | ||||
|  | ||||
|         TEST_RESULT_VOID(httpQueryFree(query), "free query"); | ||||
|         TEST_RESULT_VOID(httpQueryFree(NULL), "free null query"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
| @@ -512,7 +510,6 @@ testRun(void) | ||||
|         TEST_RESULT_STR(strPtr(strNewBuf(buffer)),  "01234567890123456789012345678901012", "    check response"); | ||||
|  | ||||
|         TEST_RESULT_VOID(httpClientFree(client), "free client"); | ||||
|         TEST_RESULT_VOID(httpClientFree(NULL), "free null client"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
|   | ||||
| @@ -265,7 +265,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(testIoReadCloseCalled, true, "    check io object closed"); | ||||
|  | ||||
|         TEST_RESULT_VOID(ioReadFree(read), "    free read object"); | ||||
|         TEST_RESULT_VOID(ioReadFree(NULL), "    free null read object"); | ||||
|  | ||||
|         // Read a zero-length buffer to be sure it is not passed on to the filter group | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -333,10 +332,7 @@ testRun(void) | ||||
|         TEST_RESULT_PTR(ioFilterInterface(bufferFilter), &bufferFilter->interface, "    check filter interface"); | ||||
|  | ||||
|         TEST_RESULT_VOID(ioFilterFree(bufferFilter), "    free buffer filter"); | ||||
|         TEST_RESULT_VOID(ioFilterFree(NULL), "    free NULL filter"); | ||||
|  | ||||
|         TEST_RESULT_VOID(ioFilterGroupFree(filterGroup), "    free filter group object"); | ||||
|         TEST_RESULT_VOID(ioFilterGroupFree(NULL), "    free NULL filter group object"); | ||||
|  | ||||
|         // Mixed line and buffer read | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -415,7 +411,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(testIoWriteCloseCalled, true, "    check io object closed"); | ||||
|  | ||||
|         TEST_RESULT_VOID(ioWriteFree(write), "    free write object"); | ||||
|         TEST_RESULT_VOID(ioWriteFree(NULL), "    free null write object"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         ioBufferSizeSet(3); | ||||
|   | ||||
| @@ -221,7 +221,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(ioReadEof(tlsClientIoRead(client)), true, "    check eof = true"); | ||||
|  | ||||
|         TEST_RESULT_VOID(tlsClientFree(client), "free client"); | ||||
|         TEST_RESULT_VOID(tlsClientFree(NULL), "free null client"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
|   | ||||
							
								
								
									
										88
									
								
								test/src/module/common/objectTest.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								test/src/module/common/objectTest.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Test Object Helper Macros | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| TestObject Type | ||||
| ***********************************************************************************************************************************/ | ||||
| #define TEST_OBJECT_TYPE                                            TestObject | ||||
| #define TEST_OBJECT_PREFIX                                          testObject | ||||
|  | ||||
| typedef struct TestObject | ||||
| { | ||||
|     MemContext *memContext;                                         // Mem context | ||||
| } TestObject; | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Macros for function logging | ||||
| ***********************************************************************************************************************************/ | ||||
| #define FUNCTION_LOG_TEST_OBJECT_TYPE                                                                                              \ | ||||
|     TestObject * | ||||
| #define FUNCTION_LOG_TEST_OBJECT_FORMAT(value, buffer, bufferSize)                                                                 \ | ||||
|     objToLog(value, STRINGIFY(TestObject), buffer, bufferSize) | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object | ||||
| ***********************************************************************************************************************************/ | ||||
| void testObjectFree(TestObject *this); | ||||
|  | ||||
| OBJECT_DEFINE_FREE(TEST_OBJECT); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Free object resource | ||||
| ***********************************************************************************************************************************/ | ||||
| bool testObjectFreeResourceCalled = false; | ||||
|  | ||||
| static void testObjectFreeResource(void *thisVoid); | ||||
|  | ||||
| OBJECT_DEFINE_FREE_RESOURCE_BEGIN(TEST_OBJECT, LOG, logLevelTrace) | ||||
| { | ||||
|     testObjectFreeResourceCalled = true; | ||||
| } | ||||
| OBJECT_DEFINE_FREE_RESOURCE_END(LOG); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| New object | ||||
| ***********************************************************************************************************************************/ | ||||
| TestObject * | ||||
| testObjectNew(void) | ||||
| { | ||||
|     FUNCTION_LOG_VOID(logLevelTrace); | ||||
|  | ||||
|     TestObject *this = NULL; | ||||
|  | ||||
|     MEM_CONTEXT_NEW_BEGIN(STRINGIFY(TestObject)) | ||||
|     { | ||||
|         this = memNew(sizeof(TestObject)); | ||||
|         this->memContext = memContextCurrent(); | ||||
|  | ||||
|         memContextCallbackSet(this->memContext, testObjectFreeResource, (void *)1); | ||||
|     } | ||||
|     MEM_CONTEXT_NEW_END(); | ||||
|  | ||||
|     FUNCTION_LOG_RETURN(TEST_OBJECT, this); | ||||
| } | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Test Run | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| testRun(void) | ||||
| { | ||||
|     FUNCTION_HARNESS_VOID(); | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("OBJECT_DEFINE*()")) | ||||
|     { | ||||
|         TestObject *testObject = NULL; | ||||
|  | ||||
|         TEST_ASSIGN(testObject, testObjectNew(), "new test object"); | ||||
|         TEST_RESULT_VOID(testObjectFree(testObject), "    free object"); | ||||
|         TEST_RESULT_BOOL(testObjectFreeResourceCalled, true, "    check callback"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
| } | ||||
| @@ -21,7 +21,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(regExpMatch(regExp, strNew("bcdef")), false, "no match regexp"); | ||||
|  | ||||
|         TEST_RESULT_VOID(regExpFree(regExp), "free regexp"); | ||||
|         TEST_RESULT_VOID(regExpFree(NULL), "free NULL regexp"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|   | ||||
| @@ -35,7 +35,6 @@ testRun(void) | ||||
|  | ||||
|         TEST_RESULT_VOID(bufFree(buffer), "free buffer"); | ||||
|         TEST_RESULT_VOID(bufFree(bufNew(0)), "free empty buffer"); | ||||
|         TEST_RESULT_VOID(bufFree(NULL), "free null buffer"); | ||||
|  | ||||
|         TEST_RESULT_VOID(bufMove(NULL, memContextTop()), "move null buffer"); | ||||
|  | ||||
|   | ||||
| @@ -21,7 +21,6 @@ testRun(void) | ||||
|         TEST_RESULT_INT(lstSize(store->list), 0, "list empty"); | ||||
|  | ||||
|         TEST_RESULT_VOID(kvFree(store), "free kv"); | ||||
|         TEST_RESULT_VOID(kvFree(NULL), "free null kv"); | ||||
|     } | ||||
|  | ||||
|     // ----------------------------------------------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -84,7 +84,6 @@ testRun(void) | ||||
|             strPtr(xmlNodeAttribute(xmlNodeChild(rootNode, strNew("Name"), true), strNew("id"))), "test", "get attribute"); | ||||
|  | ||||
|         TEST_RESULT_VOID(xmlDocumentFree(xmlDocument), "free xmldoc"); | ||||
|         TEST_RESULT_VOID(xmlDocumentFree(NULL), "free null xmldoc"); | ||||
|  | ||||
|         // Create an empty document, add data to it, and output xml | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -53,7 +53,6 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(end - begin < wait->waitTime + 1200, true, "    upper range check"); | ||||
|  | ||||
|         TEST_RESULT_VOID(waitFree(wait), "    free wait"); | ||||
|         TEST_RESULT_VOID(waitFree(NULL), "    free null wait"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
|   | ||||
| @@ -53,7 +53,6 @@ testRun(void) | ||||
|         // Free | ||||
|         //-------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(infoArchiveFree(info), "infoArchiveFree() - free archive info"); | ||||
|         TEST_RESULT_VOID(infoArchiveFree(NULL), "    NULL ptr"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|   | ||||
| @@ -86,7 +86,6 @@ testRun(void) | ||||
|         // Free | ||||
|         //-------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(infoBackupFree(infoBackup), "infoBackupFree() - free backup info"); | ||||
|         TEST_RESULT_VOID(infoBackupFree(NULL), "    NULL ptr"); | ||||
|     } | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("infoBackupData(), infoBackupDataTotal(), infoBackupDataToLog()")) | ||||
|   | ||||
| @@ -155,7 +155,6 @@ testRun(void) | ||||
|         // infoPgFree | ||||
|         //-------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(infoPgFree(infoPg), "infoPgFree() - free infoPg"); | ||||
|         TEST_RESULT_VOID(infoPgFree(NULL), "    NULL ptr"); | ||||
|  | ||||
|         // infoPgDataToLog | ||||
|         //-------------------------------------------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -241,7 +241,6 @@ testRun(void) | ||||
|         // infoFree() | ||||
|         //-------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(infoFree(info), "infoFree() - free info memory context"); | ||||
|         TEST_RESULT_VOID(infoFree(NULL), "    NULL ptr"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|   | ||||
| @@ -214,7 +214,6 @@ testRun(void) | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_RESULT_VOID(protocolCommandFree(command), "free command"); | ||||
|         TEST_RESULT_VOID(protocolCommandFree(NULL), "free null command"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
| @@ -339,7 +338,6 @@ testRun(void) | ||||
|  | ||||
|                 // Free client | ||||
|                 TEST_RESULT_VOID(protocolClientFree(client), "free client"); | ||||
|                 TEST_RESULT_VOID(protocolClientFree(NULL), "free null client"); | ||||
|             } | ||||
|             HARNESS_FORK_PARENT_END(); | ||||
|         } | ||||
| @@ -432,7 +430,6 @@ testRun(void) | ||||
|                 TEST_RESULT_VOID(protocolServerProcess(server), "run process loop"); | ||||
|  | ||||
|                 TEST_RESULT_VOID(protocolServerFree(server), "free server"); | ||||
|                 TEST_RESULT_VOID(protocolServerFree(NULL), "free null server"); | ||||
|             } | ||||
|             HARNESS_FORK_PARENT_END(); | ||||
|         } | ||||
| @@ -462,7 +459,6 @@ testRun(void) | ||||
|  | ||||
|         // Free job | ||||
|         TEST_RESULT_VOID(protocolParallelJobFree(job), "free job"); | ||||
|         TEST_RESULT_VOID(protocolParallelJobFree(NULL), "free null job"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         HARNESS_FORK_BEGIN() | ||||
| @@ -633,7 +629,6 @@ testRun(void) | ||||
|  | ||||
|                 // Free parallel | ||||
|                 TEST_RESULT_VOID(protocolParallelFree(parallel), "free parallel"); | ||||
|                 TEST_RESULT_VOID(protocolParallelFree(NULL), "free null parallel"); | ||||
|             } | ||||
|             HARNESS_FORK_PARENT_END(); | ||||
|         } | ||||
|   | ||||
| @@ -146,7 +146,6 @@ testRun(void) | ||||
|         TEST_RESULT_PTR(storageDriver(storageTest), storageTest->driver, "    check driver"); | ||||
|  | ||||
|         TEST_RESULT_VOID(storageFree(storageTest), "free storage"); | ||||
|         TEST_RESULT_VOID(storageFree(NULL), "free null storage"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
| @@ -886,8 +885,6 @@ testRun(void) | ||||
|         TEST_RESULT_VOID(ioReadClose(storageReadIo(file)), "    close file"); | ||||
|  | ||||
|         TEST_RESULT_VOID(storageReadFree(storageNewReadNP(storageTest, fileName)), "   free file"); | ||||
|         TEST_RESULT_VOID(storageReadFree(NULL), "   free null file"); | ||||
|         TEST_RESULT_VOID(storageReadPosixFree(NULL), "   free null posix file"); | ||||
|  | ||||
|         TEST_RESULT_VOID(storageReadMove(NULL, memContextTop()), "   move null file"); | ||||
|     } | ||||
| @@ -988,8 +985,6 @@ testRun(void) | ||||
|         TEST_RESULT_VOID(ioWrite(storageWriteIo(file), buffer), "   write to file"); | ||||
|         TEST_RESULT_VOID(ioWriteClose(storageWriteIo(file)), "   close file"); | ||||
|         TEST_RESULT_VOID(storageWriteFree(storageNewWriteNP(storageTest, fileName)), "   free file"); | ||||
|         TEST_RESULT_VOID(storageWriteFree(NULL), "   free null file"); | ||||
|         TEST_RESULT_VOID(storageWritePosixFree(NULL), "   free null posix file"); | ||||
|         TEST_RESULT_VOID(storageWriteMove(NULL, memContextTop()), "   move null file"); | ||||
|  | ||||
|         Buffer *expectedBuffer = storageGetNP(storageNewReadNP(storageTest, fileName)); | ||||
|   | ||||
| @@ -211,12 +211,8 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced"); | ||||
|  | ||||
|         TEST_RESULT_VOID(storagePutNP(write, contentBuf), "write file"); | ||||
|         TEST_RESULT_VOID( | ||||
|             storageWriteRemoteClose((StorageWriteRemote *)storageWriteDriver(write)), | ||||
|             "close file again"); | ||||
|         TEST_RESULT_VOID( | ||||
|             storageWriteRemoteFree((StorageWriteRemote *)storageWriteDriver(write)), | ||||
|             "free file"); | ||||
|         TEST_RESULT_VOID(storageWriteRemoteClose((StorageWriteRemote *)storageWriteDriver(write)), "close file again"); | ||||
|         TEST_RESULT_VOID(storageWriteFree(write), "free file"); | ||||
|  | ||||
|         // Make sure the file was written correctly | ||||
|         TEST_RESULT_BOOL( | ||||
| @@ -229,10 +225,7 @@ testRun(void) | ||||
|         TEST_RESULT_VOID(ioWriteOpen(storageWriteIo(write)), "open file"); | ||||
|         TEST_RESULT_VOID(ioWrite(storageWriteIo(write), contentBuf), "write bytes"); | ||||
|  | ||||
|         TEST_RESULT_VOID( | ||||
|             storageWriteRemoteFree((StorageWriteRemote *)storageWriteDriver(write)), | ||||
|             "free file"); | ||||
|         TEST_RESULT_VOID(storageWriteRemoteFree(NULL), "free null file"); | ||||
|         TEST_RESULT_VOID(storageWriteFree(write), "free file"); | ||||
|  | ||||
|         TEST_RESULT_UINT( | ||||
|             storageInfoNP(storageTest, strNew("repo/test2.txt.pgbackrest.tmp")).size, 16384, "file exists and is partial"); | ||||
|   | ||||
| @@ -588,9 +588,7 @@ testRun(void) | ||||
|         TEST_RESULT_BOOL(storageWriteSyncFile(write), true, "file is synced"); | ||||
|         TEST_RESULT_BOOL(storageWriteSyncPath(write), true, "path is synced"); | ||||
|  | ||||
|         TEST_RESULT_VOID( | ||||
|             storageWriteS3Close((StorageWriteS3 *)storageWriteDriver(write)), | ||||
|             "close file again"); | ||||
|         TEST_RESULT_VOID(storageWriteS3Close((StorageWriteS3 *)storageWriteDriver(write)), "close file again"); | ||||
|  | ||||
|         // Zero-length file | ||||
|         TEST_ASSIGN(write, storageNewWriteNP(s3, strNew("file.txt")), "new write file"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user