[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1433410636-26812-5-git-send-email-linux@rasmusvillemoes.dk>
Date: Thu, 4 Jun 2015 11:37:11 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-kernel@...r.kernel.org
Subject: [RFC/PATCH 4/8] lib/kobject.c: Use strreplace
There's probably not many slashes in kobj->name, but starting over
when we see one feels wrong.
Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
lib/kobject.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index 3b841b97fccd..597d962d3d4d 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -258,7 +258,6 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
va_list vargs)
{
const char *old_name = kobj->name;
- char *s;
if (kobj->name && !fmt)
return 0;
@@ -270,8 +269,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
}
/* ewww... some of these buggers have '/' in the name ... */
- while ((s = strchr(kobj->name, '/')))
- s[0] = '!';
+ strreplace((char *)kobj->name, '/', '!');
kfree(old_name);
return 0;
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists