aboutsummaryrefslogtreecommitdiff
path: root/src/app/main/subsysmgr.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-11-05 10:24:34 -0500
committerNick Mathewson <nickm@torproject.org>2019-11-07 07:28:43 -0500
commit3afbb29bee060b191e10aaec134a819047c3cf5e (patch)
treec5ab5e5e3ff707c4b322be4841bb79c4c905455e /src/app/main/subsysmgr.c
parent0f0a9bdf332002bb0542dae6bb00e922af5dcf63 (diff)
downloadtor-3afbb29bee060b191e10aaec134a819047c3cf5e.tar.gz
tor-3afbb29bee060b191e10aaec134a819047c3cf5e.zip
subsysmgr: use IDX_NONE is an exception value, not -1.
Diffstat (limited to 'src/app/main/subsysmgr.c')
-rw-r--r--src/app/main/subsysmgr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/app/main/subsysmgr.c b/src/app/main/subsysmgr.c
index 4189519cad..8be4a7d75c 100644
--- a/src/app/main/subsysmgr.c
+++ b/src/app/main/subsysmgr.c
@@ -33,15 +33,19 @@
**/
static bool subsystem_array_validated = false;
+/** Index value indicating that a subsystem has no options/state object, and
+ * so that object does not have an index. */
+#define IDX_NONE (-1)
+
/**
* Runtime status of a single subsystem.
**/
typedef struct subsys_status_t {
/** True if the given subsystem is initialized. */
bool initialized;
- /** Index for this subsystem's options object, or -1 for none. */
+ /** Index for this subsystem's options object, or IDX_NONE for none. */
int options_idx;
- /** Index for this subsystem's state object, or -1 for none. */
+ /** Index for this subsystem's state object, or IDX_NONE for none. */
int state_idx;
} subsys_status_t;
@@ -62,8 +66,8 @@ subsys_status_clear(subsys_status_t *status)
return;
memset(status, 0, sizeof(*status));
status->initialized = false;
- status->state_idx = -1;
- status->options_idx = -1;
+ status->state_idx = IDX_NONE;
+ status->options_idx = IDX_NONE;
}
/**