summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-30 11:13:51 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-07-30 11:13:51 +0000
commitbe3092e5ae97b2849b4eb4710bda635c670c5ee6 (patch)
tree56698a8e4471a4df294d18bc646208c1af707e01 /Build
parent35415781f9b07704a404491bd1092ec880cec8c1 (diff)
kpathsea: minor cleanup
git-svn-id: svn://tug.org/texlive/trunk@23277 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog7
-rw-r--r--Build/source/texk/kpathsea/dir.c10
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c14
-rw-r--r--Build/source/texk/kpathsea/lib.h4
-rw-r--r--Build/source/texk/kpathsea/progname.c2
5 files changed, 22 insertions, 15 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 190c0bffb47..bfe6def546b 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-30 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dir.c (kpathsea_dir_p, dir_p), lib.h: Unconstify string parms.
+ * elt-dirs.c (dir_list_add, checked_dir_list_add, do_subdir,
+ expand_elt): Unconstify string parms and local vars.
+ * progname.c (kpathsea_selfdir): Don't uselessly initialize ret.
+
2011-07-29 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* tilde.c [WIN32]: Use kpathsea_getpwnam().
diff --git a/Build/source/texk/kpathsea/dir.c b/Build/source/texk/kpathsea/dir.c
index 37a556b343c..19d06fe4089 100644
--- a/Build/source/texk/kpathsea/dir.c
+++ b/Build/source/texk/kpathsea/dir.c
@@ -27,7 +27,7 @@
false if not. */
boolean
-kpathsea_dir_p (kpathsea kpse, const_string fn)
+kpathsea_dir_p (kpathsea kpse, string fn)
{
/* FIXME : using the stat() replacement in gnuw32,
we could avoid this win32 specific code. However,
@@ -36,7 +36,7 @@ kpathsea_dir_p (kpathsea kpse, const_string fn)
#ifdef WIN32
int fa;
- kpathsea_normalize_path(kpse, (string)fn);
+ kpathsea_normalize_path(kpse, fn);
fa = GetFileAttributes(fn);
#ifdef KPSE_DEBUG
@@ -60,9 +60,9 @@ kpathsea_dir_p (kpathsea kpse, const_string fn)
#if defined(KPSE_COMPAT_API)
boolean
-dir_p (const_string fn)
+dir_p (string fn)
{
- return kpathsea_dir_p(kpse_def, fn);
+ return kpathsea_dir_p (kpse_def, fn);
}
#endif
@@ -141,6 +141,6 @@ kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks)
int
dir_links (const_string fn, long nlinks)
{
- return kpathsea_dir_links(kpse_def, fn, nlinks);
+ return kpathsea_dir_links (kpse_def, fn, nlinks);
}
#endif
diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c
index c9ad0aaffaf..cb658207d03 100644
--- a/Build/source/texk/kpathsea/elt-dirs.c
+++ b/Build/source/texk/kpathsea/elt-dirs.c
@@ -32,7 +32,7 @@
DIR ends with a DIR_SEP for the benefit of later searches. */
static void
-dir_list_add (str_llist_type *l, const_string dir)
+dir_list_add (str_llist_type *l, string dir)
{
char last_char = dir[strlen (dir) - 1];
string saved_dir
@@ -47,7 +47,7 @@ dir_list_add (str_llist_type *l, const_string dir)
/* If DIR is a directory, add it to the list L. */
static void
-checked_dir_list_add (kpathsea kpse, str_llist_type *l, const_string dir)
+checked_dir_list_add (kpathsea kpse, str_llist_type *l, string dir)
{
if (kpathsea_dir_p (kpse, dir))
dir_list_add (l, dir);
@@ -94,7 +94,7 @@ cached (kpathsea kpse, const_string key)
/* Handle the magic path constructs. */
/* Declare recursively called routine. */
-static void expand_elt (kpathsea, str_llist_type *, const_string, unsigned);
+static void expand_elt (kpathsea, str_llist_type *, string, unsigned);
/* POST is a pointer into the original element (which may no longer be
@@ -108,8 +108,8 @@ static char dirname[MAX_PATH];
#endif
static void
-do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt,
- unsigned elt_length, const_string post)
+do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, string elt,
+ unsigned elt_length, string post)
{
#ifdef WIN32
WIN32_FIND_DATA find_file_data;
@@ -305,10 +305,10 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt,
looking for magic constructs at START. */
static void
-expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, const_string elt,
+expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, string elt,
unsigned start)
{
- const_string dir = elt + start, post;
+ string dir = elt + start, post;
while (*dir != 0)
{
diff --git a/Build/source/texk/kpathsea/lib.h b/Build/source/texk/kpathsea/lib.h
index 23ef34e3147..13a4f4c7c8c 100644
--- a/Build/source/texk/kpathsea/lib.h
+++ b/Build/source/texk/kpathsea/lib.h
@@ -186,9 +186,9 @@ extern KPSEDLL void xputenv_int (const_string var, int value);
extern KPSEDLL string xgetcwd (void);
/* Returns true if FN is a directory or a symlink to a directory. */
-extern KPSEDLL boolean kpathsea_dir_p (kpathsea kpse, const_string fn);
+extern KPSEDLL boolean kpathsea_dir_p (kpathsea kpse, string fn);
#if defined (KPSE_COMPAT_API)
-extern KPSEDLL boolean dir_p (const_string fn);
+extern KPSEDLL boolean dir_p (string fn);
#endif
/* If FN is a readable directory, return the number of links it has.
diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c
index 9313ccbabb0..a4b1272fe34 100644
--- a/Build/source/texk/kpathsea/progname.c
+++ b/Build/source/texk/kpathsea/progname.c
@@ -335,9 +335,9 @@ remove_dots (kpathsea kpse, string dir)
string
kpathsea_selfdir (kpathsea kpse, const_string argv0)
{
- string ret = NULL;
string self = NULL;
string name;
+ string ret;
if (kpathsea_absolute_p (kpse, argv0, true)) {
self = xstrdup (argv0);