GNU bug report logs - #11375
[PATCH] simplify/clarify xfns.c, replacing 4 lines with one

Previous Next

Package: emacs;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Sat, 28 Apr 2012 22:04:01 UTC

Severity: minor

Tags: patch

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11375 in the body.
You can then email your comments to 11375 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11375; Package emacs. (Sat, 28 Apr 2012 22:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Meyering <jim <at> meyering.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 28 Apr 2012 22:04:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bug-emacs <at> gnu.org
Subject: [PATCH] simplify/clarify xfns.c, replacing 4 lines with one
Date: Sun, 29 Apr 2012 00:02:03 +0200
2012-04-28  Jim Meyering  <meyering <at> redhat.com>

	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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11375; Package emacs. (Wed, 02 May 2012 10:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 11375 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Jim Meyering <jim <at> meyering.net>
Cc: 11375 <at> debbugs.gnu.org
Subject: Re: bug#11375: [PATCH] simplify/clarify xfns.c,
	replacing 4 lines with one
Date: Wed, 02 May 2012 18:20:41 +0800
Jim Meyering <jim <at> meyering.net> writes:

> 2012-04-28  Jim Meyering  <meyering <at> redhat.com>
>
> 	simplify/clarify xfns.c, replacing 4 lines with one
> 	* src/xfns.c (x_window): Replace strlen+xmalloc+strncpy with xstrdup.

Thanks, committed to trunk.




bug closed, send any further explanations to 11375 <at> debbugs.gnu.org and Jim Meyering <jim <at> meyering.net> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 02 May 2012 10:23:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 May 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.