From 492f9d5de7db74aeb3a905246c4efd7cb29227a8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 5 Jul 2011 12:02:49 -0700 Subject: Split out is_printable_string() into util.c This useful function is split out so it will be available to programs other than ftdump. Signed-off-by: Simon Glass Acked-by: David Gibson --- util.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 9cead84..cc68933 100644 --- a/util.h +++ b/util.h @@ -1,6 +1,8 @@ #ifndef _UTIL_H #define _UTIL_H +#include + /* * Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc. * @@ -53,4 +55,13 @@ static inline void *xrealloc(void *p, size_t len) extern char *xstrdup(const char *s); extern char *join_path(const char *path, const char *name); +/** + * Check a string of a given length to see if it is all printable and + * has a valid terminator. + * + * @param data The string to check + * @param len The string length including terminator + * @return 1 if a valid printable string, 0 if not */ +int util_is_printable_string(const void *data, int len); + #endif /* _UTIL_H */ -- cgit v1.1