texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5601] avoid redundant checks for negative arguments to scrolling functi


From: Gavin D. Smith
Subject: [5601] avoid redundant checks for negative arguments to scrolling functions
Date: Sun, 25 May 2014 17:00:57 +0000

Revision: 5601
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5601
Author:   gavin
Date:     2014-05-25 17:00:56 +0000 (Sun, 25 May 2014)
Log Message:
-----------
avoid redundant checks for negative arguments to scrolling functions

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-25 15:45:43 UTC (rev 5600)
+++ trunk/ChangeLog     2014-05-25 17:00:56 UTC (rev 5601)
@@ -1,5 +1,12 @@
 2014-05-25  Gavin Smith  <address@hidden>
+       
+       * info/session.c (info_scroll_half_screen_down)
+       (info_scroll_half_screen_up, info_down_line, info_up_line):
+       Rely on checks in _scroll_forward and _scroll_backward for
+       negative arguments.
 
+2014-05-25  Gavin Smith  <address@hidden>
+
        * info/filesys.c (info_file_find_next_in_path): Use infopath_next
        to iterate over INFOPATH.  Don't take a path argument.  Callers
        updated.

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2014-05-25 15:45:43 UTC (rev 5600)
+++ trunk/info/session.c        2014-05-25 17:00:56 UTC (rev 5601)
@@ -1326,19 +1326,13 @@
 /* Scroll the window forward by N lines.  */
 DECLARE_INFO_COMMAND (info_down_line, _("Scroll down by lines"))
 {
-  if (count < 0)
-    info_up_line (window, -count, key);
-  else
-    _scroll_forward (window, count, key, IS_PageOnly);
+  _scroll_forward (window, count, key, IS_PageOnly);
 }
 
 /* Scroll the window backward by N lines.  */
 DECLARE_INFO_COMMAND (info_up_line, _("Scroll up by lines"))
 {
-  if (count < 0)
-    info_down_line (window, -count, key);
-  else
-    _scroll_backward (window, count, key, IS_PageOnly);
+  _scroll_backward (window, count, key, IS_PageOnly);
 }
 
 /* Lines to scroll when using commands that scroll by half screen size
@@ -1350,22 +1344,17 @@
 DECLARE_INFO_COMMAND (info_scroll_half_screen_down,
                       _("Scroll down by half screen size"))
 {
-  if (count < 0)
-    info_scroll_half_screen_up (window, -count, key);
-  else
-    {
-      int lines;
+  int lines;
 
-      if (info_explicit_arg)
-        default_scroll_size = count;
+  if (info_explicit_arg)
+    default_scroll_size = count;
 
-      if (default_scroll_size > 0)
-        lines = default_scroll_size;
-      else
-        lines = (the_screen->height + 1) / 2;
+  if (default_scroll_size > 0)
+    lines = default_scroll_size;
+  else
+    lines = (the_screen->height + 1) / 2;
 
-      _scroll_forward (window, lines, key, IS_PageOnly);
-    }
+  _scroll_forward (window, lines, key, IS_PageOnly);
 }
 
 /* Scroll the window backward by N lines and remember N as default for
@@ -1373,22 +1362,7 @@
 DECLARE_INFO_COMMAND (info_scroll_half_screen_up,
                       _("Scroll up by half screen size"))
 {
-  if (count < 0)
-    info_scroll_half_screen_down (window, -count, key);
-  else
-    {
-      int lines;
-
-      if (info_explicit_arg)
-        default_scroll_size = count;
-
-      if (default_scroll_size > 0)
-        lines = default_scroll_size;
-      else
-        lines = (the_screen->height + 1) / 2;
-
-      _scroll_backward (window, lines, key, IS_PageOnly);
-    }
+  info_scroll_half_screen_up (window, key, -count);
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]