aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/sed/process.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-08-02 15:35:53 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-08-02 15:35:53 +0000
commit249a8a8003098e796792e9c523d5211ba8018755 (patch)
tree28eb9f5b34b69220ddb6a8851690b7601c8f3e3c /usr.bin/sed/process.c
parent27c9d425316339bed59b9669160deadb195ce443 (diff)
downloadsrc-249a8a8003098e796792e9c523d5211ba8018755.tar.gz
src-249a8a8003098e796792e9c523d5211ba8018755.zip
sed(1): Revert r303047 "cleanup" and therefore r303572.
While big, the change was meant to have no effect on behavior and instead so far we have found two regressions: one in the etcupdate tests and another one in the games/openttd port[1]. Revert to a known working state. We will likely have to split the patch in functional parts before bringing back the changes. PR: 195929 Reported by: danfe, madpilot [1]
Notes
Notes: svn path=/head/; revision=303662
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r--usr.bin/sed/process.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index ba2a12f4dd71..d4779febd8f6 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -67,14 +67,14 @@ static SPACE HS, PS, SS, YS;
#define hs HS.space
#define hsl HS.len
-static inline int applies(struct s_command *);
-static void do_tr(const struct s_tr *);
-static void flush_appends(void);
-static void lputs(const char *, size_t);
-static int regexec_e(const regex_t *, const char *, int, int,
- size_t, size_t);
-static void regsub(SPACE *, const char *, const char *);
-static int substitute(const struct s_command *);
+static inline int applies(struct s_command *);
+static void do_tr(struct s_tr *);
+static void flush_appends(void);
+static void lputs(char *, size_t);
+static int regexec_e(regex_t *, const char *, int, int, size_t,
+ size_t);
+static void regsub(SPACE *, char *, char *);
+static int substitute(struct s_command *);
struct s_appends *appends; /* Array of pointers to strings to append. */
static int appendx; /* Index into appends array. */
@@ -83,7 +83,7 @@ int appendnum; /* Size of appends array. */
static int lastaddr; /* Set by applies if last address of a range. */
static int sdone; /* If any substitutes since last line input. */
/* Iov structure for 'w' commands. */
-static const regex_t *defpreg;
+static regex_t *defpreg;
size_t maxnsub;
regmatch_t *match;
@@ -377,13 +377,13 @@ resetstate(void)
* and then swap them.
*/
static int
-substitute(const struct s_command *cp)
+substitute(struct s_command *cp)
{
SPACE tspace;
- const regex_t *re;
+ regex_t *re;
regoff_t slen;
int lastempty, n;
- regoff_t le = 0;
+ size_t le = 0;
char *s;
s = ps;
@@ -489,7 +489,7 @@ substitute(const struct s_command *cp)
* Perform translation ('y' command) in the pattern space.
*/
static void
-do_tr(const struct s_tr *y)
+do_tr(struct s_tr *y)
{
SPACE tmp;
char c, *p;
@@ -579,7 +579,7 @@ flush_appends(void)
}
static void
-lputs(const char *s, size_t len)
+lputs(char *s, size_t len)
{
static const char escapes[] = "\\\a\b\f\r\t\v";
int c, col, width;
@@ -659,7 +659,7 @@ lputs(const char *s, size_t len)
}
static int
-regexec_e(const regex_t *preg, const char *string, int eflags, int nomatch,
+regexec_e(regex_t *preg, const char *string, int eflags, int nomatch,
size_t start, size_t stop)
{
int eval;
@@ -691,7 +691,7 @@ regexec_e(const regex_t *preg, const char *string, int eflags, int nomatch,
* Based on a routine by Henry Spencer
*/
static void
-regsub(SPACE *sp, const char *string, const char *src)
+regsub(SPACE *sp, char *string, char *src)
{
int len, no;
char c, *dst;
@@ -763,7 +763,7 @@ cspace(SPACE *sp, const char *p, size_t len, enum e_spflag spflag)
* Close all cached opened files and report any errors
*/
void
-cfclose(struct s_command *cp, const struct s_command *end)
+cfclose(struct s_command *cp, struct s_command *end)
{
for (; cp != end; cp = cp->next)