Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stuart Levy
partiview
Commits
8b0dbefb
Commit
8b0dbefb
authored
Nov 30, 2013
by
slevy
Browse files
Const-ify.
parent
30b178ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/findfile.c
View file @
8b0dbefb
...
...
@@ -44,8 +44,8 @@ geom.umn.edu; email: software@geom.umn.edu. */
#include <stdlib.h>
static
char
**
dirlist
=
NULL
;
static
void
dirprefix
(
char
*
file
,
char
*
dir
);
static
CONST
char
**
dirlist
=
NULL
;
static
void
dirprefix
(
CONST
char
*
file
,
char
*
dir
);
char
*
envexpand
(
char
*
s
);
/*-----------------------------------------------------------------------
...
...
@@ -60,14 +60,14 @@ char *envexpand(char *s);
* and expands all environment variables in them.
*/
void
filedirs
(
char
*
dirs
[])
filedirs
(
CONST
char
*
dirs
[])
{
char
buf
[
1024
]
,
**
p
;
char
buf
[
1024
];
int
i
,
ndirs
;
char
**
odirlist
=
dirlist
;
CONST
char
**
odirlist
=
dirlist
;
for
(
ndirs
=
0
;
dirs
[
ndirs
]
!=
NULL
;
++
ndirs
);
dirlist
=
OOGLNewNE
(
char
*
,
ndirs
+
1
,
"filedirs: dirlist"
);
dirlist
=
OOGLNewNE
(
CONST
char
*
,
ndirs
+
1
,
"filedirs: dirlist"
);
for
(
i
=
0
;
i
<
ndirs
;
++
i
)
{
strcpy
(
buf
,
dirs
[
i
]);
envexpand
(
buf
);
...
...
@@ -75,6 +75,7 @@ filedirs(char *dirs[])
}
dirlist
[
ndirs
]
=
NULL
;
if
(
odirlist
)
{
CONST
char
**
p
;
for
(
p
=
odirlist
;
*
p
!=
NULL
;
++
p
)
free
(
*
p
);
OOGLFree
(
odirlist
);
}
...
...
@@ -87,7 +88,7 @@ filedirs(char *dirs[])
* Author: mbp
* Date: Wed Feb 12 14:09:48 1992
*/
char
**
CONST
char
**
getfiledirs
()
{
return
dirlist
;
...
...
@@ -133,10 +134,10 @@ getfiledirs()
* permission.
*/
char
*
findfile
(
char
*
superfile
,
char
*
file
)
findfile
(
CONST
char
*
superfile
,
CONST
char
*
file
)
{
static
char
*
path
=
NULL
;
register
char
**
dirp
;
CONST
char
**
dirp
;
char
pbuf
[
1024
];
int
trydot
=
1
;
...
...
@@ -190,7 +191,7 @@ findfile(char *superfile, char *file)
* otherwise dir is set to "".
*/
static
void
dirprefix
(
char
*
path
,
char
*
dir
)
dirprefix
(
CONST
char
*
path
,
char
*
dir
)
{
register
char
*
end
;
...
...
src/findfile.h
View file @
8b0dbefb
...
...
@@ -13,9 +13,9 @@
extern
"C"
{
#endif
extern
char
**
getfiledirs
(
void
);
extern
char
*
findfile
(
char
*
superfile
,
char
*
fname
);
extern
void
filedirs
(
char
**
dirs
);
extern
CONST
char
**
getfiledirs
(
void
);
extern
char
*
findfile
(
CONST
char
*
superfile
,
CONST
char
*
fname
);
extern
void
filedirs
(
CONST
char
**
dirs
);
extern
char
*
envexpand
(
char
*
str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment