ncurses 5.7 - patch 20100109
[ncurses.git] / panel / p_replace.c
index 5d0d295c8b17e4a23875d257c601343fba077c15..b4bf6f4a36e66a926e9f4fa31f276f85287a6766 100644 (file)
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_replace.c,v 1.9 2005/02/19 16:41:31 tom Exp $")
+MODULE_ID("$Id: p_replace.c,v 1.10 2009/02/07 23:11:45 tom Exp $")
 
 NCURSES_EXPORT(int)
 replace_panel(PANEL * pan, WINDOW *win)
 {
-  T((T_CALLED("replace_panel(%p,%p)"), pan, win));
+  int rc = ERR;
 
-  if (!pan)
-    returnCode(ERR);
+  T((T_CALLED("replace_panel(%p,%p)"), pan, win));
 
-  if (IS_LINKED(pan))
+  if (pan)
     {
-      Touchpan(pan);
-      PANEL_UPDATE(pan, (PANEL *) 0);
+      GetHook(pan);
+      if (IS_LINKED(pan))
+       {
+         Touchpan(pan);
+         PANEL_UPDATE(pan, (PANEL *) 0);
+       }
+      pan->win = win;
+      rc = OK;
     }
-
-  pan->win = win;
-
-  returnCode(OK);
+  returnCode(rc);
 }