X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=menu%2Fm_item_top.c;h=6518d545028b6df5768188932dfbbca91af2c55b;hb=d30f99439fcc8d4bb4c38e5c4afb4f6555fc6ad4;hp=57f1a4315e45fb4129459818eadb61d8873da77c;hpb=04d942c3d98cf0a929c6afb17be8c10d4ae39af0;p=ncurses.git diff --git a/menu/m_item_top.c b/menu/m_item_top.c index 57f1a431..6518d545 100644 --- a/menu/m_item_top.c +++ b/menu/m_item_top.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2021 Thomas E. Dickey * * Copyright 1998-2004,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_top.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: m_item_top.c,v 1.15 2021/03/27 23:46:29 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,17 +51,15 @@ MODULE_ID("$Id: m_item_top.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $" | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ MENU_EXPORT(int) -set_top_row(MENU * menu, int row) +set_top_row(MENU *menu, int row) { - ITEM *item; - T((T_CALLED("set_top_row(%p,%d)"), (void *)menu, row)); if (menu) { if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if (menu->items == (ITEM **) 0) + if (menu->items == (ITEM **)0) RETURN(E_NOT_CONNECTED); if ((row < 0) || (row > (menu->rows - menu->arows))) @@ -72,6 +70,8 @@ set_top_row(MENU * menu, int row) if (row != menu->toprow) { + ITEM *item; + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); @@ -93,7 +93,7 @@ set_top_row(MENU * menu, int row) | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ MENU_EXPORT(int) -top_row(const MENU * menu) +top_row(const MENU *menu) { T((T_CALLED("top_row(%p)"), (const void *)menu)); if (menu && menu->items && *(menu->items))