[Patch] Unused code / command.C

Roland Baer roland at verifysoft.de
Mon Aug 21 13:31:36 CEST 2006


Hello,

please find attached my patch regarding unused code in command.C/rxvt.h
- unused.patch

In principle two patches, the little removing of 
  if (shade < 0) shade = 0;
should be obvious, the surrounding if checks that already.

At the point of "if (ch == C0_SYN)" (C0_SYN is 22), ch is already
at least 32. As C0_SYN is not used elsewhere in the code, and
digging through Internet references, this char can be continuously
sent to keep a connection alive. So considering two C0_SYNs received,
the first would be eliminated, the 2nd stored in string[n++] without
going through the checks. Overall this behaviour seams obsolete,
can't happen, is filtered out since a long time, time to remove that.
Subsequently the methods  rxvt_term::cmd_get8() and rxvt_term::next_octet()
can then also be nuked.

Best regards,

	Roland Bär
-------------- next part --------------
Index: rxvt.h
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/rxvt.h,v
retrieving revision 1.261
diff -u -w -r1.261 rxvt.h
--- rxvt.h	29 Jul 2006 21:44:44 -0000	1.261
+++ rxvt.h	21 Aug 2006 19:01:02 -0000
@@ -1221,8 +1221,6 @@
 
   wchar_t next_char () NOTHROW;
   wchar_t cmd_getc () THROW ((class out_of_input));
-  uint32_t next_octet () NOTHROW;
-  uint32_t cmd_get8 () THROW ((class out_of_input));
 
   bool cmd_parse ();
   void mouse_report (XButtonEvent &ev);
Index: command.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/command.C,v
retrieving revision 1.314
diff -u -w -r1.314 command.C
--- command.C	6 Jul 2006 23:48:11 -0000	1.314
+++ command.C	21 Aug 2006 19:01:09 -0000
@@ -2300,7 +2300,6 @@
 
     upper_lim_r = upper_lim_g = upper_lim_b = 65535;
   } else {
-    if (shade < 0) shade = 0;
     if (shade > 100) shade = 100;
 
     lower_lim_r = lower_lim_g = lower_lim_b = 0;
@@ -2844,15 +2843,6 @@
   return NOCHAR;
 }
 
-// read the next octet
-uint32_t
-rxvt_term::next_octet () NOTHROW
-{
-  return cmdbuf_ptr < cmdbuf_endp
-         ? (unsigned char)*cmdbuf_ptr++
-         : NOCHAR;
-}
-
 static class out_of_input out_of_input;
 
 /* rxvt_cmd_getc () - Return next input character */
@@ -2871,17 +2861,6 @@
   return c;
 }
 
-uint32_t
-rxvt_term::cmd_get8 () THROW ((class out_of_input))
-{
-  uint32_t c = next_octet ();
-
-  if (c == NOCHAR)
-    throw out_of_input;
-
-  return c;
-}
-
 /*{{{ print pipe */
 /*----------------------------------------------------------------------*/
 #ifdef PRINTPIPE
@@ -3685,9 +3664,6 @@
         // stop at some sane length
         return NULL;
 
-      if (ch == C0_SYN)
-        string[n++] = cmd_get8 ();
-      else
         string[n++] = ch;
     }
 


More information about the rxvt-unicode mailing list