mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
config: use ptrdiff_t for all field-offset members.
Previously we used int here, but it is more correct to use ptrdiff_t. (This never actually matters for our code in practice, since the structure we are managing here never exceed INT_MAX in size.)
This commit is contained in:
parent
34f3fcef40
commit
539158f2be
2 changed files with 5 additions and 3 deletions
|
@ -72,7 +72,7 @@ typedef struct config_format_t {
|
||||||
const struct_member_t *extra;
|
const struct_member_t *extra;
|
||||||
/** The position of a config_suite_t pointer within the toplevel object,
|
/** The position of a config_suite_t pointer within the toplevel object,
|
||||||
* or -1 if there is no such pointer. */
|
* or -1 if there is no such pointer. */
|
||||||
int config_suite_offset;
|
ptrdiff_t config_suite_offset;
|
||||||
} config_format_t;
|
} config_format_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "lib/conf/conftesting.h"
|
#include "lib/conf/conftesting.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
/** Enumeration of types which option values can take */
|
/** Enumeration of types which option values can take */
|
||||||
typedef enum config_type_t {
|
typedef enum config_type_t {
|
||||||
CONFIG_TYPE_STRING = 0, /**< An arbitrary string. */
|
CONFIG_TYPE_STRING = 0, /**< An arbitrary string. */
|
||||||
|
@ -89,7 +91,7 @@ typedef struct struct_member_t {
|
||||||
* Offset of this field within the structure. Compute this with
|
* Offset of this field within the structure. Compute this with
|
||||||
* offsetof(structure, fieldname).
|
* offsetof(structure, fieldname).
|
||||||
**/
|
**/
|
||||||
int offset;
|
ptrdiff_t offset;
|
||||||
} struct_member_t;
|
} struct_member_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +104,7 @@ typedef struct struct_member_t {
|
||||||
typedef struct struct_magic_decl_t {
|
typedef struct struct_magic_decl_t {
|
||||||
const char *typename;
|
const char *typename;
|
||||||
uint32_t magic_val;
|
uint32_t magic_val;
|
||||||
int magic_offset;
|
ptrdiff_t magic_offset;
|
||||||
} struct_magic_decl_t;
|
} struct_magic_decl_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue