[PATCH i-g-t v2 04/21] lib/igt_drm_fdinfo: Stop ignoring space where not needed

Lucas De Marchi lucas.demarchi at intel.com
Tue Apr 23 23:44:14 UTC 2024


strto[ul]l() family of functions already ignore leading spaces. There's
no need to be explicit.

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 lib/igt_drm_fdinfo.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
index b700ec317..cab677df2 100644
--- a/lib/igt_drm_fdinfo.c
+++ b/lib/igt_drm_fdinfo.c
@@ -97,10 +97,9 @@ static int parse_engine(char *line, struct drm_client_fdinfo *info,
 		}
 	}
 
-	if (found >= 0) {
-		while (*++p && isspace(*p));
+	p++;
+	if (found >= 0)
 		*val = strtoull(p, NULL, 10);
-	}
 
 	return found;
 }
@@ -172,9 +171,8 @@ static int parse_region(char *line, struct drm_client_fdinfo *info,
 	if (found < 0)
 		goto out;
 
-	while (*++p && isspace(*p))
-		;
-	*val = strtoull(p, NULL, 10);
+	p++;
+	*val = strtoull(p, &p, 10);
 
 	p = index(p, ' ');
 	if (!p)
-- 
2.43.0



More information about the igt-dev mailing list