texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/window.h: Eliminate #define used to use th


From: Gavin D. Smith
Subject: branch master updated: * info/window.h: Eliminate #define used to use the same three fields in two different structures, as the comment explaining it took more space up than it would have taken simply to write the lines twice.
Date: Fri, 02 Dec 2022 17:58:26 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new d5a846b5f6 * info/window.h: Eliminate #define used to use the same 
three fields in two different structures, as the comment explaining it took 
more space up than it would have taken simply to write the lines twice.
d5a846b5f6 is described below

commit d5a846b5f66d6fd4a7a9e1635cbd8316e711e8c1
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Fri Dec 2 22:58:12 2022 +0000

    * info/window.h: Eliminate #define used to use the same three fields
    in two different structures, as the comment explaining it took
    more space up than it would have taken simply to write the lines
    twice.
---
 ChangeLog     |  7 +++++++
 info/window.h | 23 ++++++++---------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 57502e50f5..8e21c29a3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-12-02  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * info/window.h: Eliminate #define used to use the same three fields
+       in two different structures, as the comment explaining it took
+       more space up than it would have taken simply to write the lines
+       twice.
+
 2022-12-02  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * info/session.c (info_beginning_of_line): Avoid freezing
diff --git a/info/window.h b/info/window.h
index e59a519cca..1f38ca84a0 100644
--- a/info/window.h
+++ b/info/window.h
@@ -44,21 +44,12 @@ typedef struct line_map_struct
   long *map;       /* The map itself */
 } LINE_MAP;
 
-/* The exact same elements are used within the WINDOW_STATE structure and a
-   subsection of the WINDOW structure.  We could define a structure which
-   contains this elements, and include that structure in each of WINDOW_STATE
-   and WINDOW.  But that would lead references in the code such as
-   window->state->node which we would like to avoid.  Instead, we #define the
-   elements here, and simply include the define in both data structures. Thus,
-   if you need to change window state information, here is where you would
-   do it.  NB> The last element does NOT end with a semi-colon. */
-#define WINDOW_STATE_DECL \
-   NODE *node;          /* The node displayed in this window. */ \
-   long pagetop;        /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
-   long point           /* Offset within NODE of the cursor position. */
-
+/* Note: The same elements are used within the WINDOW_STATE structure and a
+   subsection of the WINDOW structure. */
 typedef struct {
-  WINDOW_STATE_DECL;            /* What gets saved. */
+   NODE *node;          /* The node displayed in this window. */
+   long pagetop;        /* LINE_STARTS[PAGETOP] is first line in WINDOW. */
+   long point;          /* Offset within NODE of the cursor position. */
 } WINDOW_STATE;
 
 typedef struct match_struct
@@ -87,7 +78,9 @@ typedef struct window_struct
   long first_row;       /* Offset of the first line in the_screen. */
   long goal_column;     /* Column to place the cursor in when moving it up and 
                            down.  -1 means the column it is currently in. */
-  WINDOW_STATE_DECL;    /* Node, pagetop and point. */
+  NODE *node;           /* The node displayed in this window. */
+  long pagetop;         /* LINE_STARTS[PAGETOP] is first line in WINDOW. */
+  long point;           /* Offset within NODE of the cursor position. */
   LINE_MAP line_map;    /* Current line map */
   char *modeline;       /* Calculated text of the modeline for this window. */
   long *line_starts;    /* Offsets of printed line starts in node->contents.*/



reply via email to

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