You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-20 23:59:28 +02:00
More C type cleanup.
* Remove typec.h entirely. * Order all typdefs above local includes.
This commit is contained in:
@ -64,7 +64,7 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Cleanup C types. Remove <backrest/> defined types included with the C types. Remove redefinition of standard C types.</p>
|
||||
<p>Cleanup C types. Remove <code>typec.h</code>. Order all typdefs above local includes.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
|
@ -4,12 +4,16 @@ Block Cipher Header
|
||||
#ifndef CIPHER_BLOCK_H
|
||||
#define CIPHER_BLOCK_H
|
||||
|
||||
#include "cipher/cipher.h"
|
||||
|
||||
// Track cipher state
|
||||
/***********************************************************************************************************************************
|
||||
CipherBlock object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct CipherBlock CipherBlock;
|
||||
|
||||
// Functions
|
||||
#include "cipher/cipher.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
CipherBlock *cipherBlockNew(
|
||||
CipherMode mode, const char *cipherName, const unsigned char *pass, size_t passSize, const char *digestName);
|
||||
size_t cipherBlockProcessSize(CipherBlock *this, size_t sourceSize);
|
||||
|
@ -4,9 +4,11 @@ Cipher Header
|
||||
#ifndef CIPHER_CIPHER_H
|
||||
#define CIPHER_CIPHER_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
// Define cipher modes
|
||||
/***********************************************************************************************************************************
|
||||
Cipher modes
|
||||
***********************************************************************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
cipherModeEncrypt,
|
||||
|
@ -4,7 +4,9 @@ Random Header
|
||||
#ifndef CIPHER_RANDOM_H
|
||||
#define CIPHER_RANDOM_H
|
||||
|
||||
// Functions
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void randomBytes(unsigned char *buffer, size_t size);
|
||||
|
||||
#endif
|
||||
|
@ -2,6 +2,7 @@
|
||||
Archive Push Command
|
||||
***********************************************************************************************************************************/
|
||||
#include <libgen.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
@ -12,7 +13,6 @@ Archive Push Command
|
||||
#include "common/log.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "common/typec.h"
|
||||
#include "common/wait.h"
|
||||
#include "config/config.h"
|
||||
#include "perl/exec.h"
|
||||
|
@ -6,7 +6,6 @@ Help Command
|
||||
|
||||
#include "common/io/handle.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/typec.h"
|
||||
#include "config/config.h"
|
||||
#include "config/define.h"
|
||||
#include "version.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***********************************************************************************************************************************
|
||||
Binary to String Encode/Decode
|
||||
***********************************************************************************************************************************/
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common/encode.h"
|
||||
|
@ -6,8 +6,6 @@ These high-level functions are preferred to the low-level functions for each enc
|
||||
#ifndef COMMON_ENCODE_H
|
||||
#define COMMON_ENCODE_H
|
||||
|
||||
#include "common/typec.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Encoding types
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -6,8 +6,6 @@ The high-level functions in encode.c should be used in preference to these low-l
|
||||
#ifndef COMMON_ENCODE_BASE64_H
|
||||
#define COMMON_ENCODE_BASE64_H
|
||||
|
||||
#include "common/typec.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -2,6 +2,7 @@
|
||||
Error Handler
|
||||
***********************************************************************************************************************************/
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -39,8 +39,7 @@ IMPORTANT: Never call return from within any of the error-handling blocks.
|
||||
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Error type object
|
||||
|
@ -4,6 +4,7 @@ Log Handler
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
|
@ -4,7 +4,7 @@ Log Handler
|
||||
#ifndef COMMON_LOG_H
|
||||
#define COMMON_LOG_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Log types
|
||||
|
@ -4,8 +4,14 @@ Memory Context Manager
|
||||
#ifndef COMMON_MEMCONTEXT_H
|
||||
#define COMMON_MEMCONTEXT_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Memory context object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct MemContext MemContext;
|
||||
|
||||
#include "common/error.h"
|
||||
#include "common/typec.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Memory context names cannot be larger than this size (excluding terminator) or an error will be thrown
|
||||
@ -27,11 +33,6 @@ Space is reserved for this many allocations when a context is created. When mor
|
||||
***********************************************************************************************************************************/
|
||||
#define MEM_CONTEXT_ALLOC_INITIAL_SIZE 4
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Memory context object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct MemContext MemContext;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Memory context callback function type, useful for casts in memContextCallback()
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -6,7 +6,6 @@ Regular Expression Handler
|
||||
|
||||
#include "common/memContext.h"
|
||||
#include "common/regExp.h"
|
||||
#include "common/typec.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Contains information about the regular expression handler
|
||||
|
@ -5,7 +5,7 @@ Regular Expression Handler
|
||||
#define COMMON_REGEXP_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Ini object
|
||||
RegExp object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct RegExp RegExp;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/***********************************************************************************************************************************
|
||||
Time Management
|
||||
***********************************************************************************************************************************/
|
||||
#include "stdio.h"
|
||||
#include "sys/time.h"
|
||||
|
||||
#include "common/time.h"
|
||||
#include "common/typec.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Constants describing number of sub-units in an interval
|
||||
|
@ -4,7 +4,7 @@ Time Management
|
||||
#ifndef COMMON_TIME_H
|
||||
#define COMMON_TIME_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Time types
|
||||
|
@ -1,6 +1,8 @@
|
||||
/***********************************************************************************************************************************
|
||||
Key Value Handler
|
||||
***********************************************************************************************************************************/
|
||||
#include <limits.h>
|
||||
|
||||
#include "common/memContext.h"
|
||||
#include "common/type/keyValue.h"
|
||||
#include "common/type/list.h"
|
||||
|
@ -5,7 +5,7 @@ Key Value Handler
|
||||
#define COMMON_TYPE_KEYVALUE_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Key value object
|
||||
KeyValue object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct KeyValue KeyValue;
|
||||
|
||||
|
@ -4,6 +4,11 @@ List Handler
|
||||
#ifndef COMMON_TYPE_LIST_H
|
||||
#define COMMON_TYPE_LIST_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
List object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct List List;
|
||||
|
||||
#include "common/memContext.h"
|
||||
#include "common/type/string.h"
|
||||
|
||||
@ -12,11 +17,6 @@ Define initial size of a list
|
||||
***********************************************************************************************************************************/
|
||||
#define LIST_INITIAL_SIZE 8
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
List type
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct List List;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -3,6 +3,7 @@ String Handler
|
||||
***********************************************************************************************************************************/
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -9,11 +9,11 @@ String object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct String String;
|
||||
|
||||
#include "common/type/buffer.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/type/buffer.h"
|
||||
|
||||
String *strNew(const char *string);
|
||||
String *strNewBuf(const Buffer *buffer);
|
||||
String *strNewFmt(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
@ -5,7 +5,7 @@ String List Handler
|
||||
#define COMMON_TYPE_STRINGLIST_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
String list type
|
||||
StringList object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StringList StringList;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
Variant Data Type
|
||||
***********************************************************************************************************************************/
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
@ -4,7 +4,12 @@ Variant Data Type
|
||||
#ifndef COMMON_TYPE_VARIANT_H
|
||||
#define COMMON_TYPE_VARIANT_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Variant object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct Variant Variant;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Variant type
|
||||
@ -20,18 +25,13 @@ typedef enum
|
||||
varTypeVariantList,
|
||||
} VariantType;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Variant object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct Variant Variant;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
#include "common/type/keyValue.h"
|
||||
#include "common/type/string.h"
|
||||
#include "common/type/variantList.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
Variant *varNewBool(bool data);
|
||||
bool varBool(const Variant *this);
|
||||
bool varBoolForce(const Variant *this);
|
||||
|
@ -5,7 +5,7 @@ Variant List Handler
|
||||
#define COMMON_TYPE_VARIANTLIST_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Variant list type
|
||||
Variant list object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct VariantList VariantList;
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
/***********************************************************************************************************************************
|
||||
C Types
|
||||
***********************************************************************************************************************************/
|
||||
#ifndef COMMON_TYPEC_H
|
||||
#define COMMON_TYPEC_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Include true/false
|
||||
***********************************************************************************************************************************/
|
||||
#include <stdbool.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Include NULL
|
||||
***********************************************************************************************************************************/
|
||||
#include <stdio.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Include limits for data types
|
||||
***********************************************************************************************************************************/
|
||||
#include <limits.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Define standard integer types for portability
|
||||
***********************************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Ensure that ints are at least 32 bits
|
||||
***********************************************************************************************************************************/
|
||||
#if INT_MAX < 2147483647L
|
||||
#error "int type must be at least 32 bits"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -5,7 +5,7 @@ Wait Handler
|
||||
#define COMMON_WAIT_H
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Ini object
|
||||
Wait object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct Wait Wait;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
Command and Option Configuration Definition
|
||||
***********************************************************************************************************************************/
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common/error.h"
|
||||
|
@ -4,9 +4,6 @@ Command and Option Configuration Definition
|
||||
#ifndef CONFIG_DEFINE_H
|
||||
#define CONFIG_DEFINE_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include "config/define.auto.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Section enum - defines which sections of the config an option can appear in
|
||||
***********************************************************************************************************************************/
|
||||
@ -17,6 +14,8 @@ typedef enum
|
||||
cfgDefSectionStanza, // command-line or in any config stanza section
|
||||
} ConfigDefSection;
|
||||
|
||||
#include "config/define.auto.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Define global section name
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -10,7 +10,6 @@ Execute Perl for Legacy Functionality
|
||||
#include "version.h"
|
||||
#include "common/error.h"
|
||||
#include "common/memContext.h"
|
||||
#include "common/typec.h"
|
||||
#include "config/config.h"
|
||||
#include "perl/config.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@ Checksum Implementation for Data Pages
|
||||
#ifndef POSTGRES_PAGECHECKSUM_H
|
||||
#define POSTGRES_PAGECHECKSUM_H
|
||||
|
||||
#include "common/typec.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
|
@ -4,7 +4,10 @@ Storage File
|
||||
#ifndef STORAGE_FILE_H
|
||||
#define STORAGE_FILE_H
|
||||
|
||||
#include "common/type/string.h"
|
||||
/***********************************************************************************************************************************
|
||||
Storage file object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFile StorageFile;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Types of storage files, i.e. read or write. The storage module does not allow files to be opened for both read and write since this
|
||||
@ -16,11 +19,6 @@ typedef enum
|
||||
storageFileTypeWrite,
|
||||
} StorageFileType;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Storage file object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct StorageFile StorageFile;
|
||||
|
||||
#include "storage/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -6,8 +6,14 @@ Storage Manager
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Storage object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct Storage Storage;
|
||||
|
||||
#include "common/type/buffer.h"
|
||||
#include "common/type/stringList.h"
|
||||
#include "storage/file.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Default buffer size
|
||||
@ -23,12 +29,6 @@ Default file and path modes
|
||||
#define STORAGE_FILE_MODE_DEFAULT 0640
|
||||
#define STORAGE_PATH_MODE_DEFAULT 0750
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Storage object
|
||||
***********************************************************************************************************************************/
|
||||
typedef struct Storage Storage;
|
||||
|
||||
#include "storage/file.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Path expression callback function type - used to modify paths based on expressions enclosed in <>
|
||||
|
@ -100,17 +100,6 @@ my $oTestDef =
|
||||
|
||||
&TESTDEF_TEST =>
|
||||
[
|
||||
{
|
||||
&TESTDEF_NAME => 'typec',
|
||||
&TESTDEF_TOTAL => 2,
|
||||
&TESTDEF_C => true,
|
||||
&TESTDEF_CDEF => '-DNO_ERROR -DNO_LOG',
|
||||
|
||||
&TESTDEF_COVERAGE =>
|
||||
{
|
||||
'common/typec' => TESTDEF_COVERAGE_NOCODE,
|
||||
},
|
||||
},
|
||||
{
|
||||
&TESTDEF_NAME => 'time',
|
||||
&TESTDEF_TOTAL => 2,
|
||||
|
Reference in New Issue
Block a user