commit 96e6d56571ff7d0df71997ec91a9e2dff7e3ff24
parent 826fbea8e19e11a173195213bdba52ddafdd6592
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 19 Jul 2005 04:53:45 +0000
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
Diffstat:
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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)
diff --git a/src/proto.h b/src/proto.h
@@ -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 */
diff --git a/src/search.c b/src/search.c
@@ -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 */