string_helpers: Move string_is_valid() to the header

Move string_is_valid() to the header for wider use.

While at it, rename to string_is_terminated() to be
precise about its semantics.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230208133153.22528-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Andy Shevchenko 2023-02-08 15:31:51 +02:00 committed by Jakub Kicinski
parent a136391ae4
commit f1db99c07b
2 changed files with 11 additions and 10 deletions

View file

@ -11,6 +11,11 @@ struct device;
struct file;
struct task_struct;
static inline bool string_is_terminated(const char *s, int len)
{
return memchr(s, '\0', len) ? true : false;
}
/* Descriptions of the types of units to
* print in */
enum string_size_units {