- 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)
#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 */
/* 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;
* 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);
/* 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 */