Treat textlist item number as int instead of short

cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838952
This commit is contained in:
Tatsuya Kinoshita
2021-03-30 20:15:07 +09:00
parent ac59b52134
commit 1a9bcdf202
4 changed files with 17 additions and 8 deletions

View File

@@ -119,7 +119,8 @@ unshiftHist(Hist *hist, char *ptr)
{
HistItem *item;
if (hist == NULL || hist->list == NULL)
if (hist == NULL || hist->list == NULL ||
hist->list->nitem >= HIST_LIST_MAX)
return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
(ListItem *)hist->list->first, NULL);
@@ -137,7 +138,8 @@ pushHist(Hist *hist, char *ptr)
{
HistItem *item;
if (hist == NULL || hist->list == NULL)
if (hist == NULL || hist->list == NULL ||
hist->list->nitem >= HIST_LIST_MAX)
return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
NULL, (ListItem *)hist->list->last);
@@ -157,7 +159,8 @@ pushHashHist(Hist *hist, char *ptr)
{
HistItem *item;
if (hist == NULL || hist->list == NULL)
if (hist == NULL || hist->list == NULL ||
hist->list->nitem >= HIST_LIST_MAX)
return NULL;
item = getHashHist(hist, ptr);
if (item) {