wlist.c, `const' ness
This commit is contained in:
parent
e4c7a8df32
commit
9ed7ce4e9e
|
|
@ -11,11 +11,11 @@ struct wordlist {
|
|||
|
||||
typedef struct wordlist wordlist;
|
||||
|
||||
int wl_length(wordlist *wlist);
|
||||
int wl_length(const wordlist *wlist);
|
||||
void wl_free(wordlist *wlist);
|
||||
wordlist * wl_copy(wordlist *wlist);
|
||||
wordlist * wl_splice(wordlist *elt, wordlist *list);
|
||||
void wl_print(wordlist *wlist, FILE *fp);
|
||||
void wl_print(const wordlist *wlist, FILE *fp);
|
||||
wordlist * wl_build(char **v);
|
||||
char ** wl_mkvec(wordlist *wl);
|
||||
wordlist * wl_append(wordlist *wlist, wordlist *nwl);
|
||||
|
|
@ -31,7 +31,7 @@ void wl_append_word(wordlist **first, wordlist **last, char *word);
|
|||
wordlist *wl_chop(wordlist *wlist);
|
||||
wordlist *wl_chop_rest(wordlist *wlist);
|
||||
|
||||
wordlist *wl_find(const char *string, wordlist *wlist);
|
||||
wordlist *wl_find(const char *string, const wordlist *wlist);
|
||||
void wl_delete_slice(wordlist *from, wordlist *to);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
|
||||
/* Determine the length of a word list. */
|
||||
int
|
||||
wl_length(wordlist *wlist)
|
||||
wl_length(const wordlist *wl)
|
||||
{
|
||||
int i = 0;
|
||||
wordlist *wl;
|
||||
|
||||
for (wl = wlist; wl; wl = wl->wl_next)
|
||||
for (; wl; wl = wl->wl_next)
|
||||
i++;
|
||||
return (i);
|
||||
}
|
||||
|
|
@ -90,11 +89,9 @@ printword(char *string, FILE *fp)
|
|||
|
||||
/* Print a word list. (No \n at the end...) */
|
||||
void
|
||||
wl_print(wordlist *wlist, FILE *fp)
|
||||
wl_print(const wordlist *wl, FILE *fp)
|
||||
{
|
||||
wordlist *wl;
|
||||
|
||||
for (wl = wlist; wl; wl = wl->wl_next) {
|
||||
for (; wl; wl = wl->wl_next) {
|
||||
printword(wl->wl_word, fp);
|
||||
if (wl->wl_next)
|
||||
putc(' ', fp);
|
||||
|
|
@ -360,12 +357,12 @@ wl_chop_rest(wordlist *wl)
|
|||
*/
|
||||
|
||||
wordlist *
|
||||
wl_find(const char *string, wordlist *wl)
|
||||
wl_find(const char *string, const wordlist *wl)
|
||||
{
|
||||
for (; wl; wl = wl->wl_next)
|
||||
if (eq(string, wl->wl_word))
|
||||
break;
|
||||
return wl;
|
||||
return (wordlist *) wl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue