in find_history() and get_history_completion(), make parameters const

where possible


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2896 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-19 04:53:45 +00:00
parent 826fbea8e1
commit 96e6d56571
3 changed files with 11 additions and 9 deletions

View File

@ -161,6 +161,8 @@ CVS code -
- Only include this function when DISABLE_SPELLER isn't defined,
as the alternate spell checking code is now the only place
where it's used. (DLR)
find_history(), get_history_completion()
- Make parameters const where possible. (DLR)
- winio.c:
edit_redraw(), edit_refresh()
- Clean up and simplify. (DLR)

View File

@ -518,13 +518,13 @@ bool history_has_changed(void);
#endif
void history_init(void);
void history_reset(const filestruct *h);
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
char *s, size_t len);
filestruct *find_history(const filestruct *h_start, const filestruct
*h_end, const char *s, size_t len);
void update_history(filestruct **h, const char *s);
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
#ifndef DISABLE_TABCOMP
char *get_history_completion(filestruct **h, char *s, size_t len);
char *get_history_completion(filestruct **h, const char *s, size_t len);
#endif
#endif /* !NANO_SMALL */

View File

@ -1180,14 +1180,14 @@ void history_reset(const filestruct *h)
/* Return the first node containing the first len characters of the
* string s in the history list, starting at h_start and ending at
* h_end, or NULL if there isn't one. */
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
char *s, size_t len)
filestruct *find_history(const filestruct *h_start, const filestruct
*h_end, const char *s, size_t len)
{
filestruct *p;
const filestruct *p;
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
if (strncmp(s, p->data, len) == 0)
return p;
return (filestruct *)p;
}
return NULL;
@ -1289,7 +1289,7 @@ char *get_history_newer(filestruct **h)
* looking at only the first len characters of s, and return that
* string. If there isn't one, or if len is 0, don't move h and return
* s. */
char *get_history_completion(filestruct **h, char *s, size_t len)
char *get_history_completion(filestruct **h, const char *s, size_t len)
{
assert(s != NULL);
@ -1336,7 +1336,7 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
/* If we're here, we didn't find a match, we didn't find an inexact
* match, or len is 0. Return s. */
return s;
return (char *)s;
}
#endif
#endif /* !NANO_SMALL */