[PATCH i-g-t v3 01/13] lib/igt_drm_fdinfo: Extract ignore_space()
Lucas De Marchi
lucas.demarchi at intel.com
Sat May 4 06:46:31 UTC 2024
Extract ignore_space() to be used in other places.
Signed-off-by: Lucas De Marchi <lucas.demarchi 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