2004-06-27 Tomas Ebenlendr <ebik@ucw.cz>
* normal/cmdline.c (grub_set_history): Fix off by one bug. Fixed the history buffer logic.
This commit is contained in:
parent
6eabba74e7
commit
cfb12aff28
2 changed files with 17 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-06-27 Tomas Ebenlendr <ebik@ucw.cz>
|
||||
|
||||
* normal/cmdline.c (grub_set_history): Fix off by one bug. Fixed
|
||||
the history buffer logic.
|
||||
|
||||
2004-06-27 Tomas Ebenlendr <ebik@ucw.cz>
|
||||
|
||||
* fs/ext2.c (FILETYPE_INO_MASK, FILETYPE_INO_DIRECTORY)
|
||||
|
|
|
@ -52,33 +52,31 @@ grub_set_history (int newsize)
|
|||
int delsize = hist_used - newsize;
|
||||
hist_used = newsize;
|
||||
|
||||
for (i = 0; i < delsize; i++)
|
||||
for (i = 1; i <= delsize; i++)
|
||||
{
|
||||
int pos = hist_end - i;
|
||||
if (pos > hist_size)
|
||||
pos -= hist_size;
|
||||
if (pos < 0)
|
||||
pos += hist_size;
|
||||
grub_free (old_hist_lines[pos]);
|
||||
}
|
||||
|
||||
hist_end -= delsize;
|
||||
if (hist_end < 0)
|
||||
hist_end = hist_size - hist_end;
|
||||
hist_end += hist_size;
|
||||
}
|
||||
|
||||
if (hist_pos < hist_end)
|
||||
grub_memmove (hist_lines, old_hist_lines + hist_pos,
|
||||
(hist_end - hist_pos) * sizeof (char *));
|
||||
else
|
||||
else if (hist_used)
|
||||
{
|
||||
/* Copy the first part. */
|
||||
grub_memmove (hist_lines, old_hist_lines,
|
||||
hist_pos * sizeof (char *));
|
||||
|
||||
|
||||
/* Copy the last part. */
|
||||
grub_memmove (hist_lines + hist_pos, old_hist_lines + hist_pos,
|
||||
(hist_size - hist_pos) * sizeof (char *));
|
||||
|
||||
/* Copy the older part. */
|
||||
grub_memmove (hist_lines, old_hist_lines + hist_pos,
|
||||
(hist_size - hist_pos) * sizeof (char *));
|
||||
|
||||
/* Copy the newer part. */
|
||||
grub_memmove (hist_lines + hist_size - hist_pos, old_hist_lines,
|
||||
hist_end * sizeof (char *));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue