[PATCH i-g-t v3 01/13] lib/igt_drm_fdinfo: Extract ignore_space()

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Mon May 6 20:21:36 UTC 2024


On Fri, May 03, 2024 at 11:46:31PM -0700, Lucas De Marchi wrote:
>Extract ignore_space() to be used in other places.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

>---
> lib/igt_drm_fdinfo.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
>diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
>index cab677df2..b3f6fc35a 100644
>--- a/lib/igt_drm_fdinfo.c
>+++ b/lib/igt_drm_fdinfo.c
>@@ -53,6 +53,14 @@ static size_t read_fdinfo(char *buf, const size_t sz, int at, const char *name)
> 	return count > 0 ? count : 0;
> }
>
>+static const char *ignore_space(const char *s)
>+{
>+	for (; *s && isspace(*s); s++)
>+		;
>+
>+	return s;
>+}
>+
> static int parse_engine(char *line, struct drm_client_fdinfo *info,
> 			size_t prefix_len,
> 			const char **name_map, unsigned int map_entries,
>@@ -115,8 +123,8 @@ static const char *find_kv(const char *buf, const char *key, size_t keylen)
> 	if (*p != ':')
> 		return NULL;
>
>-	for (p++; *p && isspace(*p); p++)
>-		;
>+	p++;
>+	p = ignore_space(p);
>
> 	return *p ? p : NULL;
> }
>-- 
>2.43.0
>


More information about the igt-dev mailing list