maint: syntax-check: prohibit-form-feed

* cfg.mk (sc_prohibit-form-feed): Copied from coreutils' cfg.mk.
* sed/compile.c, sed/execute.c, sed/regexp.c, sed/sed.h, sed/utils.c:
Remove form feed characters.
This commit is contained in:
Assaf Gordon committed 2018-08-04 22:09:57 -06:00
1 parent 08b9f66a0c
commit 293d1fd372
6 files changed
+7 -22

No files matched your search

+7
View File
@@ -206,6 +206,13 @@ sc_space_before_open_paren:
fi
###########################################################
sc_prohibit-form-feed:
@prohibit=$$'\f' \
in_vc_files='\.[chly]$$' \
halt='Form Feed (^L) detected' \
$(_sc_search_regexp)
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=2 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
-9
View File
@@ -27,7 +27,6 @@
#include "progname.h"
#include "xalloc.h"
#define YMAP_LENGTH 256 /*XXX shouldn't this be (UCHAR_MAX+1)?*/
#define VECTOR_ALLOC_INCREMENT 40
@@ -87,7 +86,6 @@ static struct special_files special_files[] = {
{ { NULL, false, NULL, NULL }, NULL }
};
/* Where we are in the processing of the input. */
static struct prog_info prog;
static struct error_info cur_input;
@@ -197,7 +195,6 @@ static const char errors[] =
static struct output *file_read = NULL;
static struct output *file_write = NULL;
/* Complain about an unknown command and exit. */
static void
bad_command (char ch)
@@ -224,7 +221,6 @@ bad_prog (const char *why)
exit (EXIT_BAD_USAGE);
}
/* Read the next character from the program. Return EOF if there isn't
anything to read. Keep cur_input.line up to date, so error messages
can be meaningful. */
@@ -354,7 +350,6 @@ convert_number (char *result, char *buf, const char *bufend, int base)
return p;
}
/* Read in a filename for a `r', `w', or `s///w' command. */
static struct buffer *
read_filename (void)
@@ -426,7 +421,6 @@ get_openfile (struct output **file_ptrs, const char *mode, int fail)
return p;
}
static struct sed_cmd *
next_cmd_entry (struct vector **vectorp)
{
@@ -678,7 +672,6 @@ mark_subst_opts (struct subst *cmd)
}
}
/* read in a label for a `:', `b', or `t' command */
static char *
read_label (void)
@@ -903,7 +896,6 @@ read_text (struct text_buf *buf, int leadin_ch)
pending_text = NULL;
}
/* Try to read an address for a sed command. If it succeeds,
return non-zero and store the resulting address in `*addr'.
If the input doesn't look like an address read nothing
@@ -1381,7 +1373,6 @@ compile_program (struct vector *vector)
return vector;
}
/* deal with \X escapes */
size_t
normalize_text (char *buf, size_t len, enum text_types buftype)
-7
View File
@@ -125,7 +125,6 @@ static struct line buffer;
static struct append_queue *append_head = NULL;
static struct append_queue *append_tail = NULL;
/* increase a struct line's length, making some attempt at
keeping realloc() calls under control by padding for future growth. */
static void
@@ -375,7 +374,6 @@ line_exchange (struct line *a, struct line *b, int state)
}
}
/* dummy function to simplify read_pattern_space() */
static bool
read_always_fail (struct input *input _GL_UNUSED)
@@ -403,7 +401,6 @@ read_file_line (struct input *input)
return true;
}
static inline void
output_missing_newline (struct output *outf)
{
@@ -507,7 +504,6 @@ dump_append_queue (void)
release_append_queue ();
}
/* Compute the name of the backup file for in-place editing */
static char *
get_backup_file_name (const char *name)
@@ -748,7 +744,6 @@ read_pattern_space (struct input *input, struct vector *the_program, int append)
return true;
}
static bool
last_file_with_data_p (struct input *input)
{
@@ -903,7 +898,6 @@ match_address_p (struct sed_cmd *cmd, struct input *input)
return true;
}
static void
do_list (int line_len)
{
@@ -1647,7 +1641,6 @@ execute_program (struct vector *vec, struct input *input)
return -1;
}
/* Apply the compiled script to all the named files. */
int
-2
View File
@@ -40,7 +40,6 @@ static const char errors[] =
#define NO_REGEX (errors)
#define BAD_MODIF (NO_REGEX + sizeof(N_("no previous regular expression")))
void
dfaerror (char const *mesg)
@@ -55,7 +54,6 @@ dfawarn (char const *mesg)
dfaerror (mesg);
}
static void
compile_regex_1 (struct regex *new_regex, int needed_sub)
-1
View File
@@ -184,7 +184,6 @@ struct sed_cmd {
};
_Noreturn void bad_prog (const char *why);
size_t normalize_text (char *text, size_t len, enum text_types buftype);
struct vector *compile_string (struct vector *, char *str, size_t len);
-3
View File
@@ -80,7 +80,6 @@ panic (const char *str, ...)
exit (EXIT_PANIC);
}
/* Internal routine to get a filename from open_files */
static const char * _GL_ATTRIBUTE_PURE
utils_fp_name (FILE *fp)
@@ -284,7 +283,6 @@ do_ck_fclose (FILE *fp)
if (fclose (fp) == EOF)
panic ("couldn't close %s: %s", utils_fp_name (fp), strerror (errno));
}
/* Follow symlink and panic if something fails. Return the ultimate
symlink target, stored in a temporary buffer that the caller should
@@ -393,7 +391,6 @@ ck_rename (const char *from, const char *to, const char *unlink_if_fail)
/* Implement a variable sized buffer of `stuff'. We don't know what it is,
nor do we care, as long as it doesn't mind being aligned by malloc. */