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-d3aeb78583b8master
parent
826fbea8e1
commit
96e6d56571
|
@ -161,6 +161,8 @@ CVS code -
|
||||||
- Only include this function when DISABLE_SPELLER isn't defined,
|
- Only include this function when DISABLE_SPELLER isn't defined,
|
||||||
as the alternate spell checking code is now the only place
|
as the alternate spell checking code is now the only place
|
||||||
where it's used. (DLR)
|
where it's used. (DLR)
|
||||||
|
find_history(), get_history_completion()
|
||||||
|
- Make parameters const where possible. (DLR)
|
||||||
- winio.c:
|
- winio.c:
|
||||||
edit_redraw(), edit_refresh()
|
edit_redraw(), edit_refresh()
|
||||||
- Clean up and simplify. (DLR)
|
- Clean up and simplify. (DLR)
|
||||||
|
|
|
@ -518,13 +518,13 @@ bool history_has_changed(void);
|
||||||
#endif
|
#endif
|
||||||
void history_init(void);
|
void history_init(void);
|
||||||
void history_reset(const filestruct *h);
|
void history_reset(const filestruct *h);
|
||||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||||
char *s, size_t len);
|
*h_end, const char *s, size_t len);
|
||||||
void update_history(filestruct **h, const char *s);
|
void update_history(filestruct **h, const char *s);
|
||||||
char *get_history_older(filestruct **h);
|
char *get_history_older(filestruct **h);
|
||||||
char *get_history_newer(filestruct **h);
|
char *get_history_newer(filestruct **h);
|
||||||
#ifndef DISABLE_TABCOMP
|
#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
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
|
|
12
src/search.c
12
src/search.c
|
@ -1180,14 +1180,14 @@ void history_reset(const filestruct *h)
|
||||||
/* Return the first node containing the first len characters of the
|
/* Return the first node containing the first len characters of the
|
||||||
* string s in the history list, starting at h_start and ending at
|
* string s in the history list, starting at h_start and ending at
|
||||||
* h_end, or NULL if there isn't one. */
|
* h_end, or NULL if there isn't one. */
|
||||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||||
char *s, size_t len)
|
*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) {
|
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
|
||||||
if (strncmp(s, p->data, len) == 0)
|
if (strncmp(s, p->data, len) == 0)
|
||||||
return p;
|
return (filestruct *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1289,7 +1289,7 @@ char *get_history_newer(filestruct **h)
|
||||||
* looking at only the first len characters of s, and return that
|
* 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
|
* string. If there isn't one, or if len is 0, don't move h and return
|
||||||
* s. */
|
* 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);
|
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
|
/* If we're here, we didn't find a match, we didn't find an inexact
|
||||||
* match, or len is 0. Return s. */
|
* match, or len is 0. Return s. */
|
||||||
return s;
|
return (char *)s;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
Loading…
Reference in New Issue