]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - panel/p_replace.c
ncurses 6.2 - patch 20210807
[ncurses.git] / panel / p_replace.c
index a3b88cbfa88efddaa8b684a190b7789963f4bccf..a2d56ae6316b508f684f7fbb764db7e8298f9318 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_replace.c,v 1.7 2001/02/24 23:41:38 tom Exp $")
+MODULE_ID("$Id: p_replace.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
-NCURSES_EXPORT(int)
-replace_panel (PANEL *pan, WINDOW *win)
+PANEL_EXPORT(int)
+replace_panel(PANEL * pan, WINDOW *win)
 {
-  if(!pan)
-    return(ERR);
+  int rc = ERR;
 
-  if (IS_LINKED(pan)) {
-    Touchpan(pan);
-    PANEL_UPDATE(pan,(PANEL*)0);
-  }
-  
-  pan->win = win;
+  T((T_CALLED("replace_panel(%p,%p)"), (void *)pan, (void *)win));
 
-  return(OK);
+  if (pan)
+    {
+      GetHook(pan);
+      if (IS_LINKED(pan))
+       {
+         Touchpan(pan);
+         PANEL_UPDATE(pan, (PANEL *) 0);
+       }
+      pan->win = win;
+      rc = OK;
+    }
+  returnCode(rc);
 }