summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
df0db9f)
Factor out a magic string literal which held a delimiter set yet could
be mistaken for an (assumed) fixed termination string. Concentrate the
determination of the end-of-line text encoding as well as the resulting
set of possible deliminters in one nearby location. The symbolic name
for the delimiter set eliminates the doubt on its purpose.
+static const char *delim_set = "\r\n";
+
static const char *get_line_termination(GString *buf)
{
const char *term;
static const char *get_line_termination(GString *buf)
{
const char *term;
columns = NULL;
line_number = 0;
columns = NULL;
line_number = 0;
- lines = g_strsplit_set(buf->str, "\r\n", 0);
+ lines = g_strsplit_set(buf->str, delim_set, 0);
for (l = 0; lines[l]; l++) {
line_number++;
line = lines[l];
for (l = 0; lines[l]; l++) {
line_number++;
line = lines[l];
max_columns = 1;
ret = SR_OK;
max_columns = 1;
ret = SR_OK;
- lines = g_strsplit_set(in->buf->str, "\r\n", 0);
+ lines = g_strsplit_set(in->buf->str, delim_set, 0);
for (l = 0; lines[l]; l++) {
inc->line_number++;
line = lines[l];
for (l = 0; lines[l]; l++) {
inc->line_number++;
line = lines[l];