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 <sjg@chromium.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Simon Glass 2011-07-05 12:02:49 -07:00 committed by Jon Loeliger
parent d5b3165023
commit 492f9d5de7
4 changed files with 44 additions and 26 deletions

11
util.h
View file

@ -1,6 +1,8 @@
#ifndef _UTIL_H
#define _UTIL_H
#include <stdarg.h>
/*
* 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 */