edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Christopher Brannon <chris@the-brannons.com>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] [PATCH] Initialize some stack-allocated variables.
Date: Sun, 27 Mar 2011 12:50:11 +0000	[thread overview]
Message-ID: <1301230211-31349-1-git-send-email-chris@the-brannons.com> (raw)

The uninitialized nogo variable was being used in the test of an
if-statement.  Code that assigns a value isn't guaranteed to execute
before nogo is tested.
I added some other initializations to runCommand as well,
though these aren't strictly necessary.
---
 src/buffers.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/buffers.c b/src/buffers.c
index 7710c2d..7382c13 100644
--- a/src/buffers.c
+++ b/src/buffers.c
@@ -3486,15 +3486,16 @@ readyUndo(void)
 bool
 runCommand(const char *line)
 {
-    int i, j, n, writeMode;
-    struct ebWindow *w;
-    void *ev;			/* event variables */
-    bool nogo, rc;
+    int i, j, n;
+    int writeMode = O_TRUNC;
+    struct ebWindow *w = NULL;
+    void *ev = NULL;			/* event variables */
+    bool nogo = true, rc = true;
     bool postSpace = false, didRange = false;
     char first;
     int cx = 0;			/* numeric suffix as in s/x/y/3 or w2 */
     int tagno;
-    const char *s;
+    const char *s = NULL;
     static char newline[MAXTTYLINE];
 
     if(allocatedLine) {
@@ -3637,7 +3638,6 @@ runCommand(const char *line)
     }
 
     first = *line;
-    writeMode = O_TRUNC;
     if(cmd == 'w' && first == '+')
 	writeMode = O_APPEND, first = *++line;
 
-- 
1.7.3.4


                 reply	other threads:[~2011-03-27 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1301230211-31349-1-git-send-email-chris@the-brannons.com \
    --to=chris@the-brannons.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).