delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2012/12/04/12:45:15

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=98HswEh+2w8/XUc6QjuIGV/kc1mb5IucVEkvZ4OyVao=;
b=ibcWn/YPLBftXwl3mJNrbB3CRBP+FBFpDIA8DllfxihT5ii5P9RQrvxPqdxMGa5jys
1aS4vWaymS/czdglDaU+dbZ0mQEXqIPZym5sUw+LZasvfRAFQ3YGujauQ5Z6UwoeBjv/
uUUwuNo9n6A0NMGmZeTSBm9RKx+bSdOJioAe2DRGGV0Auf5k1kdut5g+sN4vAYj+706b
MQ1Nr+FolJ8hAHTTq/6c/7yhiFE6v6PB+W/GGSAJLPoA01Bakr900mtgUjyfbyz0HcKG
PXZHu4klu5ZagzZK/N/JwQQwzN/F4RurVphKweFG2nisnRrBa7kGGgMRUAgAHTdJV3K9
zQEw==
MIME-Version: 1.0
In-Reply-To: <CAA2C=vA8kNDh=c5jXJ1r0TxVPuvKz-QViG222j=oDghS-UxeLA@mail.gmail.com>
References: <CAA2C=vA8kNDh=c5jXJ1r0TxVPuvKz-QViG222j=oDghS-UxeLA AT mail DOT gmail DOT com>
Date: Tue, 4 Dec 2012 19:45:06 +0200
Message-ID: <CAA2C=vD+ykMBRW2wBsSbgD83VjjediRt=eCZbMy4aQXS1fkG2g@mail.gmail.com>
Subject: Re: src/debug/fsdb/fullscr.c r1.12
From: Ozkan Sezer <sezeroz AT gmail DOT com>
To: djgpp-workers <djgpp-workers AT delorie DOT com>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 12/4/12, Ozkan Sezer <sezeroz AT gmail DOT com> wrote:
> Hi:
>
> As far as I can see unassemble_proper() sets its len param, however
> src/debug/fsdb/fullscr.c r1.12 comments out the call to avoid set-but-
> unused warnings but 'len' is used two lines below.  So, unless I am
> missing something, the following is needed.
>

Slightly updated patch below.  (BTW, the whole thing can actually use
some constification: things like char* str="string"; are everywhere..)

Regards.

--
O.S.

Index: src/debug/fsdb/fullscr.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/debug/fsdb/fullscr.c,v
retrieving revision 1.12
diff -u -p -r1.12 fullscr.c
--- src/debug/fsdb/fullscr.c	1 Dec 2012 04:29:46 -0000	1.12
+++ src/debug/fsdb/fullscr.c	4 Dec 2012 17:37:33 -0000
@@ -857,7 +857,7 @@ static int
 code_skip (int origin, int count)
 {
   int len, *next, i, j, k, instcount, done, leave;
-  char *state, *source /* , *inst */;
+  char *state, *inst, *source;

   if (count >= 0)
     {
@@ -889,9 +889,8 @@ code_skip (int origin, int count)
 	      j = origin - done;
 	      if (valid_instaddr (j))
 		{
-#if 0
 		  inst = unassemble_proper (j, &len);
-#endif
+		  (void) inst; /* set, but not used. */
 		  source = unassemble_source (j);
 		  next[done] = j + len;
 		  if (source)
@@ -909,9 +908,11 @@ code_skip (int origin, int count)
 			  leave = (strncmp (inst, "jmp", 3) == 0
 				   || strncmp (inst, "ret", 3) == 0
 				   || strncmp (inst, "iret", 4) == 0);
-			  if (!leave)
-			    inst = unassemble_proper (j, &len);
 #endif
+			  if (!leave) {
+			    inst = unassemble_proper (j, &len);
+			    (void) inst; /* set, but not used. */
+			  }
 			}
 		    }
 		}
@@ -927,7 +928,8 @@ code_skip (int origin, int count)
 	    if (state[j++] == 2)
 	      k--;
 	}
-      while (k > 0 && done + 2 * count <= instcount);
+      while (k > 0 && done + 2 * count <= instcount)
+	;
       if (k == 0)
 	return origin - j + 1;
       else
@@ -1025,7 +1027,7 @@ static void
 step (KIND_TYPE kind)
 {
   int i, b = -1, no, len, int03hit;
-  char *inst = 0;
+  char *inst = NULL;
   int tracing = (kind == R_Step1);
   word32 final = -1;

@@ -2204,7 +2206,7 @@ setup_save (int dummy)
 static void
 setup_restore (int booting)
 {
-  FILE *f = 0;
+  FILE *f = NULL;
   char *err = "Corrupted setup file";

   f = fopen (setupfilename, "rt");

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019