From 07c9702e8c2b041069e438d9547c85429cd32d76 Mon Sep 17 00:00:00 2001 From: Steven Luo Date: Wed, 16 Dec 2009 23:47:00 -0800 Subject: [PATCH] Move the regex #defines to configfile.c They're not needed anywhere else, so no need for them to be in the header file. --- configfile.c | 16 ++++++++++++++++ configfile.h | 18 ------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/configfile.c b/configfile.c index 5200159..7f3b905 100644 --- a/configfile.c +++ b/configfile.c @@ -28,6 +28,22 @@ #include "configfile.h" +#define MAXLINE 1024 + +/* regex matching blank lines or comments */ +#define REGEX_IGNORE "^[[:space:]]*(#|$)" +#define REGEX_IGNORE_FLAGS REG_EXTENDED|REG_NOSUB + +/* regex matching foo = "bar", with arbitrary whitespace at beginning and end + of line and surrounding the = */ +#define REGEX_CONFIG1 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*\"(.*)\"[[:space:]]*$" +#define REGEX_CONFIG1_FLAGS REG_EXTENDED + +/* regex matching foo = bar, with arbitrary whitespace at beginning of line and + surrounding the = */ +#define REGEX_CONFIG2 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*(.*)$" +#define REGEX_CONFIG2_FLAGS REG_EXTENDED|REG_NEWLINE + static regex_t re_ignore, re_config1, re_config2; static int re_init = 0; diff --git a/configfile.h b/configfile.h index c655274..b8be9e6 100644 --- a/configfile.h +++ b/configfile.h @@ -24,28 +24,10 @@ #define _CONFIGFILE_H #include -#include -#include #define DEFAULT_HOMEDIR "/home/user" #define CONFIGFILE_LOC "/.config/browser-switchboard" #define CONFIGFILE_LOC_OLD "/.config/browser-proxy" -#define MAXLINE 1024 - -/* regex matching blank lines or comments */ -#define REGEX_IGNORE "^[[:space:]]*(#|$)" -#define REGEX_IGNORE_FLAGS REG_EXTENDED|REG_NOSUB - -/* regex matching foo = "bar", with arbitrary whitespace at beginning and end - of line and surrounding the = */ -#define REGEX_CONFIG1 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*\"(.*)\"[[:space:]]*$" -#define REGEX_CONFIG1_FLAGS REG_EXTENDED - -/* regex matching foo = bar, with arbitrary whitespace at beginning of line and - surrounding the = */ -#define REGEX_CONFIG2 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*(.*)$" -#define REGEX_CONFIG2_FLAGS REG_EXTENDED|REG_NEWLINE - struct swb_config_line { /* Whether or not the line has been parsed */ -- 1.7.9.5