]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_item_top.c
ncurses 6.4 - patch 20240420
[ncurses.git] / menu / m_item_top.c
index ee0d17b43dd55c16fca16d918dde8a3ea6f45d27..68303c7676b5e6b2395d64c27391dc9998d10da7 100644 (file)
@@ -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  *
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_item_top.c,v 1.14 2020/12/12 00:38:08 tom Exp $")
+MODULE_ID("$Id: m_item_top.c,v 1.16 2021/06/17 21:11:08 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int set_top_row(MENU *menu, int row)
-|   
+|
 |   Description   :  Makes the specified row the top row in the menu
 |
 |   Return Values :  E_OK             - success
@@ -53,8 +53,6 @@ MODULE_ID("$Id: m_item_top.c,v 1.14 2020/12/12 00:38:08 tom Exp $")
 MENU_EXPORT(int)
 set_top_row(MENU *menu, int row)
 {
-  ITEM *item;
-
   T((T_CALLED("set_top_row(%p,%d)"), (void *)menu, row));
 
   if (menu)
@@ -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);
 
@@ -85,9 +85,9 @@ set_top_row(MENU *menu, int row)
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int top_row(const MENU *)
-|   
+|
 |   Description   :  Return the top row of the menu
 |
 |   Return Values :  The row number or ERR if there is no row