summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-06 15:20:12 +0000
committerharti <harti@FreeBSD.org>2004-12-06 15:20:12 +0000
commit885c50507df63c3bc97a7c11bcb5b36954aea50c (patch)
tree92a0217818248978ef3b661124daf5f52dd0c850 /usr.bin
parent930ad3d9dccfb6cee0f223e316f4dd24c3404251 (diff)
downloadFreeBSD-src-885c50507df63c3bc97a7c11bcb5b36954aea50c.zip
FreeBSD-src-885c50507df63c3bc97a7c11bcb5b36954aea50c.tar.gz
Some constification which doesn't require code rewrites.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/dir.c20
-rw-r--r--usr.bin/make/dir.h2
-rw-r--r--usr.bin/make/hash.c4
-rw-r--r--usr.bin/make/hash.h4
4 files changed, 13 insertions, 17 deletions
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index f039046..54576dd 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -190,9 +190,6 @@ static Path *dot; /* contents of current directory */
static Hash_Table mtimes;
static int DirFindName(void *, void *);
-static int DirMatchFiles(char *, Path *, Lst);
-static void DirExpandCurly(char *, char *, Lst, Lst);
-static void DirExpandInt(char *, Lst, Lst);
static int DirPrintWord(void *, void *);
static int DirPrintDir(void *, void *);
@@ -305,9 +302,9 @@ DirFindName(void *p, void *dname)
*-----------------------------------------------------------------------
*/
Boolean
-Dir_HasWildcards(char *name)
+Dir_HasWildcards(const char *name)
{
- char *cp;
+ const char *cp;
int wild = 0, brace = 0, bracket = 0;
for (cp = name; *cp; cp++) {
@@ -355,7 +352,7 @@ Dir_HasWildcards(char *name)
*-----------------------------------------------------------------------
*/
static int
-DirMatchFiles(char *pattern, Path *p, Lst expansions)
+DirMatchFiles(const char *pattern, const Path *p, Lst expansions)
{
Hash_Search search; /* Index into the directory's table */
Hash_Entry *entry; /* Current entry in the table */
@@ -403,11 +400,11 @@ DirMatchFiles(char *pattern, Path *p, Lst expansions)
*-----------------------------------------------------------------------
*/
static void
-DirExpandCurly(char *word, char *brace, Lst path, Lst expansions)
+DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
{
- char *end; /* Character after the closing brace */
- char *cp; /* Current position in brace clause */
- char *start; /* Start of current piece of brace clause */
+ const char *end; /* Character after the closing brace */
+ const char *cp; /* Current position in brace clause */
+ const char *start; /* Start of current piece of brace clause */
int bracelevel; /* Number of braces we've seen. If we see a right brace
* when this is 0, we've hit the end of the clause. */
char *file; /* Current expansion */
@@ -490,7 +487,6 @@ DirExpandCurly(char *word, char *brace, Lst path, Lst expansions)
}
}
-
/*-
*-----------------------------------------------------------------------
* DirExpandInt --
@@ -508,7 +504,7 @@ DirExpandCurly(char *word, char *brace, Lst path, Lst expansions)
*-----------------------------------------------------------------------
*/
static void
-DirExpandInt(char *word, Lst path, Lst expansions)
+DirExpandInt(const char *word, Lst path, Lst expansions)
{
LstNode ln; /* Current node */
Path *p; /* Directory in the node */
diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h
index 30b95a9..a4106bf 100644
--- a/usr.bin/make/dir.h
+++ b/usr.bin/make/dir.h
@@ -57,7 +57,7 @@ typedef struct Path {
void Dir_Init(void);
void Dir_InitDot(void);
void Dir_End(void);
-Boolean Dir_HasWildcards(char *);
+Boolean Dir_HasWildcards(const char *);
void Dir_Expand(char *, Lst, Lst);
char *Dir_FindFile(char *, Lst);
int Dir_MTime(GNode *);
diff --git a/usr.bin/make/hash.c b/usr.bin/make/hash.c
index e4036a9..5a54668 100644
--- a/usr.bin/make/hash.c
+++ b/usr.bin/make/hash.c
@@ -298,7 +298,7 @@ Hash_DeleteEntry(Hash_Table *t, Hash_Entry *e)
*---------------------------------------------------------
*/
Hash_Entry *
-Hash_EnumFirst(Hash_Table *t, Hash_Search *searchPtr)
+Hash_EnumFirst(const Hash_Table *t, Hash_Search *searchPtr)
{
searchPtr->tablePtr = t;
@@ -328,7 +328,7 @@ Hash_Entry *
Hash_EnumNext(Hash_Search *searchPtr)
{
Hash_Entry *e;
- Hash_Table *t = searchPtr->tablePtr;
+ const Hash_Table *t = searchPtr->tablePtr;
/*
* The hashEntryPtr field points to the most recently returned
diff --git a/usr.bin/make/hash.h b/usr.bin/make/hash.h
index adc7552..19d02ce 100644
--- a/usr.bin/make/hash.h
+++ b/usr.bin/make/hash.h
@@ -71,7 +71,7 @@ typedef struct Hash_Table {
* to record where we are in the search.
*/
typedef struct Hash_Search {
- Hash_Table *tablePtr; /* Table being searched. */
+ const Hash_Table *tablePtr; /* Table being searched. */
int nextIndex; /* Next bucket to check */
Hash_Entry *hashEntryPtr; /* Next entry in current bucket */
} Hash_Search;
@@ -95,7 +95,7 @@ void Hash_DeleteTable(Hash_Table *);
Hash_Entry *Hash_FindEntry(const Hash_Table *, const char *);
Hash_Entry *Hash_CreateEntry(Hash_Table *, const char *, Boolean *);
void Hash_DeleteEntry(Hash_Table *, Hash_Entry *);
-Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *);
+Hash_Entry *Hash_EnumFirst(const Hash_Table *, Hash_Search *);
Hash_Entry *Hash_EnumNext(Hash_Search *);
#endif /* _HASH */
OpenPOWER on IntegriCloud