svn commit: r184630 - projects/quota64/lib/libutil
Dag-Erling Smorgrav
des at FreeBSD.org
Tue Nov 4 05:44:07 PST 2008
Author: des
Date: Tue Nov 4 13:44:07 2008
New Revision: 184630
URL: http://svn.freebsd.org/changeset/base/184630
Log:
Avoid assigning a const char * to a char *.
MFC after: 3 weeks
Modified:
projects/quota64/lib/libutil/login_class.c
Modified: projects/quota64/lib/libutil/login_class.c
==============================================================================
--- projects/quota64/lib/libutil/login_class.c Tue Nov 4 12:30:31 2008 (r184629)
+++ projects/quota64/lib/libutil/login_class.c Tue Nov 4 13:44:07 2008 (r184630)
@@ -142,14 +142,13 @@ substvar(const char * var, const struct
int tildes = 0;
int dollas = 0;
char *p;
+ const char *q;
if (pwd != NULL) {
- /* Count the number of ~'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++)
- ++tildes;
- /* Count the number of $'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++)
- ++dollas;
+ for (q = var; *q != '\0'; ++q) {
+ tildes += (*q == '~');
+ dollas += (*q == '$');
+ }
}
np = malloc(strlen(var) + (dollas * nlen)
More information about the svn-src-projects
mailing list