all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Meyering <jim@meyering.net>
To: 11375@debbugs.gnu.org
Subject: bug#11375: [PATCH] simplify/clarify xfns.c, replacing 4 lines with one
Date: Sun, 29 Apr 2012 00:02:03 +0200	[thread overview]
Message-ID: <87ehr7ms6c.fsf@rho.meyering.net> (raw)


2012-04-28  Jim Meyering  <meyering@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





             reply	other threads:[~2012-04-28 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 22:02 Jim Meyering [this message]
2012-05-02 10:20 ` bug#11375: [PATCH] simplify/clarify xfns.c, replacing 4 lines with one Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehr7ms6c.fsf@rho.meyering.net \
    --to=jim@meyering.net \
    --cc=11375@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.