diff options
author | Colin Watson <cjwatson@debian.org> | 2003-05-01 15:54:02 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2003-05-01 15:54:02 +0000 |
commit | aaad3089ff590e46073446aeafdd9c8c904bd895 (patch) | |
tree | df46bd9aa274eabbb7d64f89aa6e77c94afbb65c /src/check_mandirs.c | |
parent | b7af8dd328523573327b0ab4e5da68ca5f8d33a7 (diff) |
Remove all assumptions that string literals have type 'char *' rather than
'const char *'. Add -Wwrite-strings for gcc.
Diffstat (limited to 'src/check_mandirs.c')
-rw-r--r-- | src/check_mandirs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/check_mandirs.c b/src/check_mandirs.c index b2f2e1ff..e4259e20 100644 --- a/src/check_mandirs.c +++ b/src/check_mandirs.c @@ -429,7 +429,7 @@ void update_db_time (void) datum key1, content1; #endif /* FAST_BTREE */ - key.dptr = KEY; + key.dptr = xstrdup (KEY); key.dsize = sizeof KEY; content.dptr = (char *) xmalloc (16); /* 11 is max long with '\0' */ (void) sprintf (content.dptr, "%ld", (long) time (NULL)); @@ -462,6 +462,7 @@ void update_db_time (void) #endif /* !FAST_BTREE */ MYDBM_CLOSE (dbf); + free (key.dptr); free (content.dptr); } @@ -471,7 +472,7 @@ void reset_db_time (void) { datum key; - key.dptr = KEY; + key.dptr = xstrdup (KEY); key.dsize = sizeof KEY; /* we don't really care if we can't open it RW - it's not fatal */ @@ -488,6 +489,7 @@ void reset_db_time (void) if (debug) fprintf (stderr, "reset_db_time()\n"); MYDBM_CLOSE (dbf); + free (key.dptr); } /* routine to prepare/create the db prior to calling testmandirs() */ @@ -540,10 +542,11 @@ short update_db (const char *manpath) datum key, content; short new; - key.dptr = KEY; + key.dptr = xstrdup (KEY); key.dsize = sizeof KEY; content = MYDBM_FETCH (dbf, key); MYDBM_CLOSE (dbf); + free (key.dptr); if (debug) fprintf (stderr, "update_db(): %ld\n", |