-// PARA_DEBUG_LOG("%s: empty items: %s\n", __func__, empty_items);
- stat_client_write(empty_items);
- free(empty_items);
+}
+
+/**
+ * check if string is a known status item.
+ *
+ * \param item buffer containing the text to check
+ *
+ * \return If \a item is a valid status item, the number of that status item is
+ * returned. Otherwise, this function returns \p -E_UNKNOWN_STAT_ITEM.
+ */
+int stat_item_valid(const char *item)
+{
+ int i;
+ if (!item || !*item)
+ return -E_UNKNOWN_STAT_ITEM;
+ FOR_EACH_STAT_ITEM(i)
+ if (!strcmp(status_item_list[i], item))
+ return i;
+ return -E_UNKNOWN_STAT_ITEM;