Skip to content

Commit

Permalink
Fix some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
slewsys committed Jan 8, 2025
1 parent 0b9dd90 commit b165c7a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ dup_argv (int argc, char **argv, ed_buffer_t *ed)
int i;

REALLOC_THROW (pathv_p, pathv_p_size,
(argc + 1) * sizeof (char *), NULL, ed);
(argc + 1) * sizeof (char *),
NULL, ed);

for (i = 0, pathv_p[i] = NULL; i < argc; ++i, pathv_p[i] = NULL, len = 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ move_lines (off_t from, off_t to, off_t after, ed_buffer_t *ed)
else
{
a1 = get_line_node (succ, ed);
if (from > after)
if (after < from)
{
b1 = get_line_node (prec, ed);

Expand All @@ -232,7 +232,7 @@ move_lines (off_t from, off_t to, off_t after, ed_buffer_t *ed)
LINK_NODES (b2, b1->q_forw);
LINK_NODES (a1->q_back, a2);
LINK_NODES (b1, a1);
ed->state->dot = after + (from > after ? to - from + 1 : 0);
ed->state->dot = after + (after < from ? to - from + 1 : 0);
}
if (ed->exec->global)
clear_global_lines (b2->q_forw, a2, to - from + 1, ed);
Expand Down
19 changes: 10 additions & 9 deletions src/ed.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ enum utf8_char_constant
# define STAT(x, y) stat ((x), (y))
#endif /* !HAVE_STAT64 */

/* In-core and hold node. */
/* In-core line node. */
typedef struct ed_line_node
{
struct ed_line_node *q_forw;
Expand Down Expand Up @@ -394,7 +394,7 @@ struct ed_core
{

#ifdef WANT_ED_REGISTER
/* Register buffers and line markers. */
/* Register buffer. */
struct ed_register *regbuf;
#endif

Expand All @@ -404,6 +404,7 @@ struct ed_core
int sp; /* Script buffer stack pointer. */
#endif

/* Line markers */
ed_line_node_t *mark[MARK_MAX];
int marks;

Expand Down Expand Up @@ -705,18 +706,18 @@ enum search_type
while (0)


/* LINK_NODES: Link prev and next nodes. */
/* LINK_NODES: Link nodes `prev' and `next'. */
#define LINK_NODES(prev, next) \
((prev)->q_forw = (next), (next)->q_back = (prev))

/* INIT_DEQUE: Link node to itself. */
#define INIT_DEQUE(node) LINK_NODES ((node), (node))

/*
* APPEND_NODE: Append node after prev.
* CAVEAT UTILITOR: APPEND_NODE fails when `prev' of the form
* p->q_back. The workaround is to assign t = p->q_back and then
* call APPEND_NODE(n, t).
* APPEND_NODE: Append node `node' after `prev'.
* Caveat: This fails when `prev' of the form `p->q_back'. The
* workaround is to assign t = p->q_back and then call
* APPEND_NODE(n, t).
*/
#define APPEND_NODE(node, prev) \
do \
Expand All @@ -726,7 +727,7 @@ enum search_type
} \
while (0)

/* UNLINK_NODE: Remove node from deque. */
/* UNLINK_NODE: Remove node `node' from deque. */
#define UNLINK_NODE(node) \
LINK_NODES ((node)->q_back, (node)->q_forw)

Expand All @@ -741,7 +742,7 @@ enum search_type
} \
while (0)

/* REALLOC_THROW: Assure at least a minimum size for buffer b. */
/* REALLOC_THROW: Assure minimum size `i' for buffer `b' with size `n'. */
#define REALLOC_THROW(b, n, i, err, ed) \
do \
{ \
Expand Down
2 changes: 1 addition & 1 deletion src/re.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ get_compiled_regex (unsigned dc, int re_type, ed_buffer_t *ed)
static char re_err[BUFSIZ]; /* regex error message buffer */
#endif

char *pattern;
char *pattern = NULL;
size_t len = 0;

#ifndef HAVE_REG_SYNTAX_T
Expand Down
2 changes: 1 addition & 1 deletion testsuite/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ED_SCRIPTS_OK_MF = \
ED_SCRIPTS_OK_R = \
rmt1.tr rmt2.tr rmt3.tr

# Ed scripts which should complete sucessfully if registers are available.
# Ed scripts which should complete sucessfully if macros are available.
ED_SCRIPTS_OK_XM = \
mac1.txm mac2.txm mac3.txm

Expand Down

0 comments on commit b165c7a

Please sign in to comment.