[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] config: use ptrdiff_t for all field-offset members.
commit 539158f2be6001a7849b7a85e053e43d7d78195a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Sep 4 10:50:09 2019 -0400
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.)
---
src/app/config/confparse.h | 2 +-
src/lib/conf/conftypes.h | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/app/config/confparse.h b/src/app/config/confparse.h
index b788e2cd1..fc07996aa 100644
--- a/src/app/config/confparse.h
+++ b/src/app/config/confparse.h
@@ -72,7 +72,7 @@ typedef struct config_format_t {
const struct_member_t *extra;
/** The position of a config_suite_t pointer within the toplevel object,
* or -1 if there is no such pointer. */
- int config_suite_offset;
+ ptrdiff_t config_suite_offset;
} config_format_t;
/**
diff --git a/src/lib/conf/conftypes.h b/src/lib/conf/conftypes.h
index fabad97d0..abfb53b21 100644
--- a/src/lib/conf/conftypes.h
+++ b/src/lib/conf/conftypes.h
@@ -33,6 +33,8 @@
#include "lib/conf/conftesting.h"
#endif
+#include <stddef.h>
+
/** Enumeration of types which option values can take */
typedef enum config_type_t {
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
* offsetof(structure, fieldname).
**/
- int offset;
+ ptrdiff_t offset;
} struct_member_t;
/**
@@ -102,7 +104,7 @@ typedef struct struct_member_t {
typedef struct struct_magic_decl_t {
const char *typename;
uint32_t magic_val;
- int magic_offset;
+ ptrdiff_t magic_offset;
} struct_magic_decl_t;
/**
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits