summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2003-10-26 03:51:47 +0000
committerPeter Wemm <peter@FreeBSD.org>2003-10-26 03:51:47 +0000
commit35ae70a663e619bff8057347c6b76563b2380a56 (patch)
tree264bdf8b6b77cd9216a66364e1bc22a88040259c
parent1bb634ce247e398483c157e44c4bd8d2cef73dd0 (diff)
downloadpw-darwin-35ae70a663e619bff8057347c6b76563b2380a56.tar.gz
pw-darwin-35ae70a663e619bff8057347c6b76563b2380a56.tar.zst
pw-darwin-35ae70a663e619bff8057347c6b76563b2380a56.zip
(mostly) Clean up some const warnings here. The code takes some liberties
because it is the originator of various const strings and knows that they came from malloc.
-rw-r--r--libutil/login_cap.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libutil/login_cap.c b/libutil/login_cap.c
index 8347b51..ad1dacb 100644
--- a/libutil/login_cap.c
+++ b/libutil/login_cap.c
@@ -104,21 +104,22 @@ static const char **
arrayize(const char *str, const char *chars, int *size)
{
int i;
- const char *ptr;
+ char *ptr;
+ const char *cptr;
const char **res = NULL;
/* count the sub-strings */
- for (i = 0, ptr = str; *ptr; i++) {
- int count = strcspn(ptr, chars);
- ptr += count;
- if (*ptr)
- ++ptr;
+ for (i = 0, cptr = str; *cptr; i++) {
+ int count = strcspn(cptr, chars);
+ cptr += count;
+ if (*cptr)
+ ++cptr;
}
/* alloc the array */
if ((ptr = allocstr(str)) != NULL) {
if ((res = allocarray(++i)) == NULL)
- free(str);
+ free((void *)(uintptr_t)(const void *)str);
else {
/* now split the string */
i = 0;
@@ -191,7 +192,7 @@ login_getclassbyname(char const *name, const struct passwd *pwd)
const char *dir;
char userpath[MAXPATHLEN];
- static const char *login_dbarray[] = { NULL, NULL, NULL };
+ static char *login_dbarray[] = { NULL, NULL, NULL };
me = (name != NULL && strcmp(name, LOGIN_MECLASS) == 0);
dir = (!me || pwd == NULL) ? NULL : pwd->pw_dir;