Subject: [PATCH] simplify/clarify xfns.c, replacing 4 lines with one

From: Jim Meyering <[email-masked]>
Date: Sun, 29 Apr 2012 00:02:03 +0200

2012-04-28  Jim Meyering  <[email-masked]>

	simplify/clarify xfns.c, replacing 4 lines with one
	* src/xfns.c (x_window): Replace strlen+xmalloc+strncpy with xstrdup.

---
 src/xfns.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 6f08ada..f7a80ce 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2439,7 +2439,6 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)

   /* Do some needed geometry management.  */
   {
-    ptrdiff_t len;
     char *tem, shell_position[sizeof "=x++" + 4 * INT_STRLEN_BOUND (int)];
     Arg gal[10];
     int gac = 0;
@@ -2508,13 +2507,11 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
         }
     }

-    len = strlen (shell_position) + 1;
     /* We don't free this because we don't know whether
        it is safe to free it while the frame exists.
        It isn't worth the trouble of arranging to free it
        when the frame is deleted.  */
-    tem = (char *) xmalloc (len);
-    strncpy (tem, shell_position, len);
+    tem = (char *) xstrdup (shell_position);
     XtSetArg (gal[gac], XtNgeometry, tem); gac++;
     XtSetValues (shell_widget, gal, gac);
   }
--
1.7.10.382.g62bc8