[Asterisk-code-review] spelling: cacheable (asterisk[master])

Josh Soref asteriskteam at digium.com
Sun Nov 7 00:04:35 CDT 2021


Josh Soref has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16783 )


Change subject: spelling: cacheable
......................................................................

spelling: cacheable

Change-Id: I12dec6a88b25431a6bb07538112dec1577b4b7de
---
M channels/chan_iax2.c
M include/asterisk/devicestate.h
M main/channel.c
M main/devicestate.c
M res/res_corosync.c
M res/res_pjsip_publish_asterisk.c
M res/res_xmpp.c
M tests/test_stasis.c
8 files changed, 57 insertions(+), 57 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/83/16783/1

diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 4decf88..80c0c8b 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -5830,7 +5830,7 @@
 /*! \brief  Create new call, interface with the PBX core */
 static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capability,
 	struct iax2_codec_pref *prefs, const struct ast_assigned_ids *assignedids,
-	const struct ast_channel *requestor, unsigned int cachable)
+	const struct ast_channel *requestor, unsigned int cacheable)
 {
 	struct ast_channel *tmp = NULL;
 	struct chan_iax2_pvt *i;
@@ -5963,7 +5963,7 @@
 	i->owner = tmp;
 	i->capability = capability;
 
-	if (!cachable) {
+	if (!cacheable) {
 		ast_set_flag(ast_channel_flags(tmp), AST_FLAG_DISABLE_DEVSTATE_CACHE);
 	}
 
diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h
index 5d7e3a4..e885c21 100644
--- a/include/asterisk/devicestate.h
+++ b/include/asterisk/devicestate.h
@@ -66,8 +66,8 @@
  *  \note This is used to define the cacheability of a device state when set.
  */
 enum ast_devstate_cache {
-	AST_DEVSTATE_NOT_CACHABLE,  /*!< This device state is not cachable */
-	AST_DEVSTATE_CACHABLE,      /*!< This device state is cachable */
+	AST_DEVSTATE_NOT_CACHABLE,  /*!< This device state is not cacheable */
+	AST_DEVSTATE_CACHABLE,      /*!< This device state is cacheable */
 };
 
 /*! \brief Devicestate provider call back */
@@ -136,7 +136,7 @@
  * \brief Tells Asterisk the State for Device is changed
  *
  * \param state the new state of the device
- * \param cachable whether this device state is cachable
+ * \param cacheable whether this device state is cacheable
  * \param fmt device name like a dial string with format parameters
  *
  * The new state of the device will be sent off to any subscribers
@@ -146,14 +146,14 @@
  * \retval 0 on success
  * \retval -1 on failure
  */
-int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt, ...)
+int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cacheable, const char *fmt, ...)
 	__attribute__((format(printf, 3, 4)));
 
 /*!
  * \brief Tells Asterisk the State for Device is changed
  *
  * \param state the new state of the device
- * \param cachable whether this device state is cachable
+ * \param cacheable whether this device state is cacheable
  * \param device device name like a dial string with format parameters
  *
  * The new state of the device will be sent off to any subscribers
@@ -163,7 +163,7 @@
  * \retval 0 on success
  * \retval -1 on failure
  */
-int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device);
+int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cacheable, const char *device);
 
 /*!
  * \brief Add device state provider
@@ -249,7 +249,7 @@
 	/*! The state of the device */
 	enum ast_device_state state;
 	/*! Flag designating the cacheability of this device state */
-	enum ast_devstate_cache cachable;
+	enum ast_devstate_cache cacheable;
 	/*! The device and eid data is stuffed here when the struct is allocated. */
 	struct ast_eid stuff[0];
 };
@@ -315,19 +315,19 @@
  * \brief Publish a device state update
  * \param[in] device The device name
  * \param[in] state The state of the device
- * \param[in] cachable Whether the device state can be cached
+ * \param[in] cacheable Whether the device state can be cached
  * \retval 0 Success
  * \retval -1 Failure
  * \since 12
  */
-#define ast_publish_device_state(device, state, cachable) \
-	ast_publish_device_state_full(device, state, cachable, &ast_eid_default)
+#define ast_publish_device_state(device, state, cacheable) \
+	ast_publish_device_state_full(device, state, cacheable, &ast_eid_default)
 
 /*!
  * \brief Publish a device state update with EID
  * \param[in] device The device name
  * \param[in] state The state of the device
- * \param[in] cachable Whether the device state can be cached
+ * \param[in] cacheable Whether the device state can be cached
  * \param[in] eid The EID of the server that originally published the message
  * \retval 0 Success
  * \retval -1 Failure
@@ -336,7 +336,7 @@
 int ast_publish_device_state_full(
 			const char *device,
 			enum ast_device_state state,
-			enum ast_devstate_cache cachable,
+			enum ast_devstate_cache cacheable,
 			struct ast_eid *eid);
 
 #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/main/channel.c b/main/channel.c
index d601595..8868260 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -7052,7 +7052,7 @@
 	ast_channel_state_set(original, ast_channel_state(clonechan));
 	ast_channel_state_set(clonechan, origstate);
 
-	/* And the swap the cachable state too. Otherwise we'd start caching
+	/* And the swap the cacheable state too. Otherwise we'd start caching
 	 * Local channels and ignoring real ones. */
 	orig_disablestatecache = ast_test_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
 	clone_disablestatecache = ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
diff --git a/main/devicestate.c b/main/devicestate.c
index ecf255f..9033047 100644
--- a/main/devicestate.c
+++ b/main/devicestate.c
@@ -199,7 +199,7 @@
 
 struct state_change {
 	AST_LIST_ENTRY(state_change) list;
-	enum ast_devstate_cache cachable;
+	enum ast_devstate_cache cacheable;
 	char device[1];
 };
 
@@ -457,7 +457,7 @@
 
 /*! Called by the state change thread to find out what the state is, and then
  *  to queue up the state change event */
-static void do_state_change(const char *device, enum ast_devstate_cache cachable)
+static void do_state_change(const char *device, enum ast_devstate_cache cacheable)
 {
 	enum ast_device_state state;
 
@@ -465,10 +465,10 @@
 
 	ast_debug(3, "Changing state for %s - state %u (%s)\n", device, state, ast_devstate2str(state));
 
-	ast_publish_device_state(device, state, cachable);
+	ast_publish_device_state(device, state, cacheable);
 }
 
-int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device)
+int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cacheable, const char *device)
 {
 	struct state_change *change;
 
@@ -489,15 +489,15 @@
 	 */
 
 	if (state != AST_DEVICE_UNKNOWN) {
-		ast_publish_device_state(device, state, cachable);
+		ast_publish_device_state(device, state, cacheable);
 	} else if (change_thread == AST_PTHREADT_NULL || !(change = ast_calloc(1, sizeof(*change) + strlen(device)))) {
 		/* we could not allocate a change struct, or */
 		/* there is no background thread, so process the change now */
-		do_state_change(device, cachable);
+		do_state_change(device, cacheable);
 	} else {
 		/* queue the change */
 		strcpy(change->device, device);
-		change->cachable = cachable;
+		change->cacheable = cacheable;
 		AST_LIST_LOCK(&state_changes);
 		AST_LIST_INSERT_TAIL(&state_changes, change, list);
 		ast_cond_signal(&change_pending);
@@ -507,7 +507,7 @@
 	return 0;
 }
 
-int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt, ...)
+int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cacheable, const char *fmt, ...)
 {
 	char buf[AST_MAX_EXTENSION];
 	va_list ap;
@@ -516,7 +516,7 @@
 	vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
-	return ast_devstate_changed_literal(state, cachable, buf);
+	return ast_devstate_changed_literal(state, cacheable, buf);
 }
 
 /*! \brief Go through the dev state change queue and update changes in the dev state thread */
@@ -536,7 +536,7 @@
 		/* Process each state change */
 		while ((current = next)) {
 			next = AST_LIST_NEXT(current, list);
-			do_state_change(current->device, current->cachable);
+			do_state_change(current->device, current->cacheable);
 			ast_free(current);
 		}
 	}
@@ -544,7 +544,7 @@
 	return NULL;
 }
 
-static struct ast_device_state_message *device_state_alloc(const char *device, enum ast_device_state state, enum ast_devstate_cache cachable, const struct ast_eid *eid)
+static struct ast_device_state_message *device_state_alloc(const char *device, enum ast_device_state state, enum ast_devstate_cache cacheable, const struct ast_eid *eid)
 {
 	struct ast_device_state_message *new_device_state;
 	char *pos;
@@ -575,7 +575,7 @@
 	new_device_state->device = pos;
 
 	new_device_state->state = state;
-	new_device_state->cachable = cachable;
+	new_device_state->cacheable = cacheable;
 
 	return new_device_state;
 }
@@ -589,7 +589,7 @@
 	}
 
 	device_state = stasis_message_data(msg);
-	if (device_state->cachable == AST_DEVSTATE_CACHABLE || !device_state->eid) {
+	if (device_state->cacheable == AST_DEVSTATE_CACHABLE || !device_state->eid) {
 		/* Ignore cacheable and aggregate messages. */
 		return;
 	}
@@ -599,7 +599,7 @@
 	 * device state republished as the aggregate.
 	 */
 	ast_publish_device_state_full(device_state->device, device_state->state,
-		device_state->cachable, NULL);
+		device_state->cacheable, NULL);
 }
 
 static void device_state_engine_cleanup(void)
@@ -709,7 +709,7 @@
 int ast_publish_device_state_full(
 	const char *device,
 	enum ast_device_state state,
-	enum ast_devstate_cache cachable,
+	enum ast_devstate_cache cacheable,
 	struct ast_eid *eid)
 {
 	RAII_VAR(struct ast_device_state_message *, device_state, NULL, ao2_cleanup);
@@ -722,7 +722,7 @@
 		return -1;
 	}
 
-	device_state = device_state_alloc(device, state, cachable, eid);
+	device_state = device_state_alloc(device, state, cacheable, eid);
 	if (!device_state) {
 		return -1;
 	}
@@ -741,10 +741,10 @@
 	 * When a device state is not to be cached we only publish to its
 	 * specific topic if something has already created the topic. Publishing
 	 * to its topic otherwise would create the topic, which may not be
-	 * necessary as it could be an ephemeral device. Uncachable updates
+	 * necessary as it could be an ephemeral device. Uncacheable updates
 	 * traditionally come from such things as Local channels.
 	 */
-	if (cachable || stasis_topic_pool_topic_exists(device_state_topic_pool, device)) {
+	if (cacheable || stasis_topic_pool_topic_exists(device_state_topic_pool, device)) {
 		topic = ast_device_state_topic(device);
 	} else {
 		topic = ast_device_state_topic_all();
@@ -767,7 +767,7 @@
 	}
 
 	device_state = stasis_message_data(message);
-	if (device_state->cachable == AST_DEVSTATE_NOT_CACHABLE) {
+	if (device_state->cacheable == AST_DEVSTATE_NOT_CACHABLE) {
 		return NULL;
 	}
 
@@ -968,14 +968,14 @@
 		event = ast_event_new(AST_EVENT_DEVICE_STATE_CHANGE,
 					    AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, device_state->device,
 					    AST_EVENT_IE_STATE, AST_EVENT_IE_PLTYPE_UINT, device_state->state,
-					    AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, device_state->cachable,
+					    AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, device_state->cacheable,
 					    AST_EVENT_IE_EID, AST_EVENT_IE_PLTYPE_RAW, device_state->eid, sizeof(*device_state->eid),
 					    AST_EVENT_IE_END);
 	} else {
 		event = ast_event_new(AST_EVENT_DEVICE_STATE,
 					    AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, device_state->device,
 					    AST_EVENT_IE_STATE, AST_EVENT_IE_PLTYPE_UINT, device_state->state,
-					    AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, device_state->cachable,
+					    AST_EVENT_IE_CACHABLE, AST_EVENT_IE_PLTYPE_UINT, device_state->cacheable,
 					    AST_EVENT_IE_END);
 	}
 
diff --git a/res/res_corosync.c b/res/res_corosync.c
index e5448b9..f89ac69 100644
--- a/res/res_corosync.c
+++ b/res/res_corosync.c
@@ -433,21 +433,21 @@
 {
 	const char *device;
 	enum ast_device_state state;
-	unsigned int cachable;
+	unsigned int cacheable;
 	struct ast_eid *event_eid;
 
 	ast_assert(ast_event_get_type(event) == AST_EVENT_DEVICE_STATE_CHANGE);
 
 	device = ast_event_get_ie_str(event, AST_EVENT_IE_DEVICE);
 	state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
-	cachable = ast_event_get_ie_uint(event, AST_EVENT_IE_CACHABLE);
+	cacheable = ast_event_get_ie_uint(event, AST_EVENT_IE_CACHABLE);
 	event_eid = (struct ast_eid *)ast_event_get_ie_raw(event, AST_EVENT_IE_EID);
 
 	if (ast_strlen_zero(device)) {
 		return;
 	}
 
-	if (ast_publish_device_state_full(device, state, cachable, event_eid)) {
+	if (ast_publish_device_state_full(device, state, cacheable, event_eid)) {
 		char eid[18];
 		ast_eid_to_str(eid, sizeof(eid), event_eid);
 		ast_log(LOG_WARNING, "Failed to publish device state message for %s from %s\n",
diff --git a/res/res_pjsip_publish_asterisk.c b/res/res_pjsip_publish_asterisk.c
index 5fea3bf..e27959a 100644
--- a/res/res_pjsip_publish_asterisk.c
+++ b/res/res_pjsip_publish_asterisk.c
@@ -204,7 +204,7 @@
 		"type", "devicestate",
 		"device", dev_state->device,
 		"state", ast_devstate_str(dev_state->state),
-		"cachable", dev_state->cachable,
+		"cacheable", dev_state->cacheable,
 		"eid", eid_str);
 	if (!json) {
 		return;
@@ -494,7 +494,7 @@
 {
 	const char *device = ast_json_string_get(ast_json_object_get(json, "device"));
 	const char *state = ast_json_string_get(ast_json_object_get(json, "state"));
-	int cachable = ast_json_integer_get(ast_json_object_get(json, "cachable"));
+	int cacheable = ast_json_integer_get(ast_json_object_get(json, "cacheable"));
 
 	if (!config->device_state) {
 		ast_debug(2, "Received device state event for resource '%s' but it is not configured to accept them\n",
@@ -515,7 +515,7 @@
 	}
 
 	ast_publish_device_state_full(device, ast_devstate_val(state),
-		cachable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,
+		cacheable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,
 		pubsub_eid);
 
 	return 0;
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index ebf128d..1815564 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -1069,7 +1069,7 @@
  * \return iks *
  */
 static iks* xmpp_pubsub_build_publish_skeleton(struct ast_xmpp_client *client, const char *node,
-					       const char *event_type, unsigned int cachable)
+					       const char *event_type, unsigned int cacheable)
 {
 	RAII_VAR(struct xmpp_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);
 	iks *request, *pubsub, *publish, *item;
@@ -1085,7 +1085,7 @@
 	item = iks_insert(publish, "item");
 	iks_insert_attrib(item, "id", node);
 
-	if (cachable == AST_DEVSTATE_NOT_CACHABLE) {
+	if (cacheable == AST_DEVSTATE_NOT_CACHABLE) {
 		iks *options, *x, *field_form_type, *field_persist;
 
 		options = iks_insert(pubsub, "publish-options");
@@ -1298,13 +1298,13 @@
  * \return void
  */
 static void xmpp_pubsub_publish_device_state(struct ast_xmpp_client *client, const char *device,
-					     const char *device_state, unsigned int cachable)
+					     const char *device_state, unsigned int cacheable)
 {
 	RAII_VAR(struct xmpp_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);
 	iks *request, *state;
-	char eid_str[20], cachable_str[2];
+	char eid_str[20], cacheable_str[2];
 
-	if (!cfg || !cfg->global || !(request = xmpp_pubsub_build_publish_skeleton(client, device, "device_state", cachable))) {
+	if (!cfg || !cfg->global || !(request = xmpp_pubsub_build_publish_skeleton(client, device, "device_state", cacheable))) {
 		return;
 	}
 
@@ -1320,8 +1320,8 @@
 	state = iks_insert(request, "state");
 	iks_insert_attrib(state, "xmlns", "http://asterisk.org");
 	iks_insert_attrib(state, "eid", eid_str);
-	snprintf(cachable_str, sizeof(cachable_str), "%u", cachable);
-	iks_insert_attrib(state, "cachable", cachable_str);
+	snprintf(cacheable_str, sizeof(cacheable_str), "%u", cacheable);
+	iks_insert_attrib(state, "cacheable", cacheable_str);
 	iks_insert_cdata(state, device_state, strlen(device_state));
 	ast_xmpp_client_send(client, iks_root(request));
 	iks_delete(request);
@@ -1376,7 +1376,7 @@
 		return;
 	}
 
-	xmpp_pubsub_publish_device_state(client, dev_state->device, ast_devstate_str(dev_state->state), dev_state->cachable);
+	xmpp_pubsub_publish_device_state(client, dev_state->device, ast_devstate_str(dev_state->state), dev_state->cacheable);
 }
 
 /*!
@@ -1460,11 +1460,11 @@
  */
 static int xmpp_pubsub_handle_event(void *data, ikspak *pak)
 {
-	char *item_id, *device_state, *mailbox, *cachable_str;
+	char *item_id, *device_state, *mailbox, *cacheable_str;
 	int oldmsgs, newmsgs;
 	iks *item, *item_content;
 	struct ast_eid pubsub_eid;
-	unsigned int cachable = AST_DEVSTATE_CACHABLE;
+	unsigned int cacheable = AST_DEVSTATE_CACHABLE;
 	item = iks_find(iks_find(iks_find(pak->x, "event"), "items"), "item");
 	if (!item) {
 		ast_log(LOG_ERROR, "Could not parse incoming PubSub event\n");
@@ -1478,13 +1478,13 @@
 		return IKS_FILTER_EAT;
 	}
 	if (!strcasecmp(iks_name(item_content), "state")) {
-		if ((cachable_str = iks_find_attrib(item_content, "cachable"))) {
-			sscanf(cachable_str, "%30u", &cachable);
+		if ((cacheable_str = iks_find_attrib(item_content, "cacheable"))) {
+			sscanf(cacheable_str, "%30u", &cacheable);
 		}
 		device_state = iks_find_cdata(item, "state");
 		ast_publish_device_state_full(item_id,
 						ast_devstate_val(device_state),
-						cachable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,
+						cacheable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,
 						&pubsub_eid);
 		return IKS_FILTER_EAT;
 	} else if (!strcasecmp(iks_name(item_content), "mailbox")) {
diff --git a/tests/test_stasis.c b/tests/test_stasis.c
index 08c3d1e..16a93ff 100644
--- a/tests/test_stasis.c
+++ b/tests/test_stasis.c
@@ -900,12 +900,12 @@
 
 static const char *cache_test_data_id(struct stasis_message *message)
 {
-	struct cache_test_data *cachable = stasis_message_data(message);
+	struct cache_test_data *cacheable = stasis_message_data(message);
 
 	if (0 != strcmp("Cacheable", stasis_message_type_name(stasis_message_type(message)))) {
 		return NULL;
 	}
-	return cachable->id;
+	return cacheable->id;
 }
 
 static struct stasis_message *cache_test_aggregate_calc_fn(struct stasis_cache_entry *entry, struct stasis_message *new_snapshot)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16783
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I12dec6a88b25431a6bb07538112dec1577b4b7de
Gerrit-Change-Number: 16783
Gerrit-PatchSet: 1
Gerrit-Owner: Josh Soref <jsoref at gmail.com>
Gerrit-CC: Friendly Automation
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211107/2d1632e3/attachment-0001.html>


More information about the asterisk-code-review mailing list