summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-15 10:53:28 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-15 10:53:28 -0400
commit442778960002ec8d78e5524ad0cbd9215fd228a2 (patch)
treec1bcb08874ecdfc723d5b5a90d2b24966a1a6f42 /parser.c
parentdc67e4106c45efaf0d6994805bdccab20ad5ca77 (diff)
remove redundant regex
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/parser.c b/parser.c
index bf8b5ae..0ed2a1c 100644
--- a/parser.c
+++ b/parser.c
@@ -507,30 +507,24 @@ static gchar* filter_input (gchar *raw_in)
g_regex_unref (strip_space);
g_free (step1);
- // remove spaces between ; and : in compound messages
- GRegex *colon_space = g_regex_new (";\\s+:", 0, 0, NULL);
- gchar *step3 = g_regex_replace_literal (colon_space, step2, -1, 0, ";:", 0, NULL);
- g_regex_unref (colon_space);
- g_free (step2);
-
// remove spaces before and after semicolons in compound messages
GRegex *semi_space = g_regex_new ("\\s*;\\s*", 0, 0, NULL);
- gchar *step4 = g_regex_replace_literal (semi_space, step3, -1, 0, ";", 0, NULL);
+ gchar *step3 = g_regex_replace_literal (semi_space, step2, -1, 0, ";", 0, NULL);
g_regex_unref (semi_space);
- g_free (step3);
+ g_free (step2);
// remove semicolon at end
GRegex *end_semi = g_regex_new (";$", 0, 0, NULL);
- gchar *step5 = g_regex_replace_literal (end_semi, step4, -1, 0, "", 0, NULL);
+ gchar *step4 = g_regex_replace_literal (end_semi, step3, -1, 0, "", 0, NULL);
g_regex_unref (end_semi);
- g_free (step4);
+ g_free (step3);
// last step may leave hanging whitespace at end
- g_strstrip (step5);
+ g_strstrip (step4);
// add single space to terminate
- gchar *filt = g_strdup_printf ("%s ", step5);
- g_free (step5);
+ gchar *filt = g_strdup_printf ("%s ", step4);
+ g_free (step4);
return filt;
}