summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin <bjacquin@exosec.fr>2012-12-11 16:04:07 +0100
committerBertrand Jacquin <bjacquin@exosec.fr>2012-12-11 16:04:07 +0100
commit3b4fbbebd891b97692f93e7a137bb6a309410253 (patch)
tree3af901fd7fcb662922d66d5f0ecb7ea19469c2ad
parent[MISC] Indent all parenthesis to match (diff)
downloadmod_virtualvalue-3b4fbbebd891b97692f93e7a137bb6a309410253.tar.gz
[MISC] Reindent all functions braces to match
http://haproxy.1wt.eu/coding-style.html
-rw-r--r--al_alias.c6
-rw-r--r--al_authn_file.c6
-rw-r--r--al_core.c21
-rw-r--r--al_dumb.c3
-rw-r--r--al_php5.c3
-rw-r--r--mod_virtualvalue.c102
6 files changed, 89 insertions, 52 deletions
diff --git a/al_alias.c b/al_alias.c
index c2e6385..084852c 100644
--- a/al_alias.c
+++ b/al_alias.c
@@ -6,7 +6,8 @@
#include "al_alias.h"
-int vv_alter_scriptalias(int argc __U__, char **argv, request_rec *r) {
+int vv_alter_scriptalias(int argc __U__, char **argv, request_rec *r)
+{
char *scriptalias;
if (!strstr(r->uri, argv[0]))
@@ -14,7 +15,8 @@ int vv_alter_scriptalias(int argc __U__, char **argv, request_rec *r) {
scriptalias = vv_flat_arg(argv[1], r);
- if (!scriptalias) {
+ if (!scriptalias)
+ {
VV_error("%s", "Can't build ScriptAlias");
return (DECLINED);
}
diff --git a/al_authn_file.c b/al_authn_file.c
index 5876928..04c39bc 100644
--- a/al_authn_file.c
+++ b/al_authn_file.c
@@ -11,14 +11,16 @@ struct authn_file_config_rec {
char *pwfile;
};
-int vv_alter_authuserfile(int argc __U__, char **argv, request_rec *r) {
+int vv_alter_authuserfile(int argc __U__, char **argv, request_rec *r)
+{
struct authn_file_config_rec *conf;
char *authuserfile;
conf = ap_get_module_config(r->per_dir_config, &authn_file_module);
authuserfile = vv_flat_arg(argv[0], r);
- if (!authuserfile) {
+ if (!authuserfile)
+ {
VV_error("%s", "Can't build AuthUserFile");
return (DECLINED);
}
diff --git a/al_core.c b/al_core.c
index ca5c812..3f992d2 100644
--- a/al_core.c
+++ b/al_core.c
@@ -9,7 +9,8 @@
#include "mod_virtualvalue.h"
#include "al_core.h"
-int vv_core_docroot(request_rec *r, char *n_root) {
+int vv_core_docroot(request_rec *r, char *n_root)
+{
request_rec *top;
core_server_config *core;
@@ -29,12 +30,14 @@ int vv_core_docroot(request_rec *r, char *n_root) {
return (OK);
}
-int vv_alter_docroot(int argc __U__, char **argv, request_rec *r) {
+int vv_alter_docroot(int argc __U__, char **argv, request_rec *r)
+{
char *docroot;
docroot = vv_flat_arg(argv[0], r);
- if (!docroot) {
+ if (!docroot)
+ {
VV_error("%s", "Can't build DocumentRoot");
return (DECLINED);
}
@@ -46,12 +49,14 @@ int vv_alter_docroot(int argc __U__, char **argv, request_rec *r) {
return (OK);
}
-int vv_alter_serveradmin(int argc __U__, char **argv, request_rec *r) {
+int vv_alter_serveradmin(int argc __U__, char **argv, request_rec *r)
+{
char *serveradmin;
serveradmin = vv_flat_arg(argv[0], r);
- if (!serveradmin) {
+ if (!serveradmin)
+ {
VV_error("%s", "Can't build ServerAdmin");
return (DECLINED);
}
@@ -63,12 +68,14 @@ int vv_alter_serveradmin(int argc __U__, char **argv, request_rec *r) {
return (OK);
}
-int vv_alter_servername(int argc __U__, char **argv, request_rec *r) {
+int vv_alter_servername(int argc __U__, char **argv, request_rec *r)
+{
char *servername;
servername = vv_flat_arg(argv[0], r);
- if (!servername) {
+ if (!servername)
+ {
VV_error("%s", "Can't build ServerName");
return (DECLINED);
}
diff --git a/al_dumb.c b/al_dumb.c
index 7b7ea23..b543fb1 100644
--- a/al_dumb.c
+++ b/al_dumb.c
@@ -4,7 +4,8 @@
#include "mod_virtualvalue.h"
#include "al_dumb.h"
-int vv_echo(int argc __U__, char **argv, request_rec *r) {
+int vv_echo(int argc __U__, char **argv, request_rec *r)
+{
char *s2;
VV_error("%s", "");
diff --git a/al_php5.c b/al_php5.c
index ca7e420..2f0a108 100644
--- a/al_php5.c
+++ b/al_php5.c
@@ -16,7 +16,8 @@
#include "mod_virtualvalue.h"
#include "al_php5.h"
-int vv_php_alter_ini(int argc __U__, char **argv, request_rec *r) {
+int vv_php_alter_ini(int argc __U__, char **argv, request_rec *r)
+{
char *arg;
VV_debug("Translating %s %s", argv[0], argv[1]);
diff --git a/mod_virtualvalue.c b/mod_virtualvalue.c
index 0bb154d..56f1125 100644
--- a/mod_virtualvalue.c
+++ b/mod_virtualvalue.c
@@ -57,7 +57,8 @@ typedef struct {
/*
* Create new configuration element
*/
-static virtualvalue_var_t *vv_var_new(apr_pool_t *pool) {
+static virtualvalue_var_t *vv_var_new(apr_pool_t *pool)
+{
virtualvalue_var_t *elm;
elm = (virtualvalue_var_t *)apr_palloc(pool, sizeof(virtualvalue_var_t));
@@ -74,7 +75,8 @@ static virtualvalue_var_t *vv_var_new(apr_pool_t *pool) {
return (elm);
}
-static virtualvalue_var_t *vv_var_append(virtualvalue_var_t *list, virtualvalue_var_t *elm) {
+static virtualvalue_var_t *vv_var_append(virtualvalue_var_t *list, virtualvalue_var_t *elm)
+{
virtualvalue_var_t *c;
if (!list || !elm)
@@ -82,9 +84,8 @@ static virtualvalue_var_t *vv_var_append(virtualvalue_var_t *list, virtualvalue_
c = list;
- while (c->next) {
+ while (c->next)
c = (virtualvalue_var_t *)c->next;
- }
c->next = elm;
return list;
@@ -119,14 +120,17 @@ tag_t tag_tab[] = {
{ NULL , 0, NULL }
};
-static char *vv_strrrstr(char *start, char *cur, const char *needle) {
+static char *vv_strrrstr(char *start, char *cur, const char *needle)
+{
char *s;
int len = strlen(needle);
s = NULL;
- while (cur >= start) {
- if (strncmp(cur, needle, len) == 0) {
+ while (cur >= start)
+ {
+ if (strncmp(cur, needle, len) == 0)
+ {
s = cur;
break;
}
@@ -137,12 +141,14 @@ static char *vv_strrrstr(char *start, char *cur, const char *needle) {
return s;
}
-static const char *vv_replace_HTTP(char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_HTTP(char *full __U__, char *search, request_rec *r)
+{
const char *header;
header = apr_table_get(r->headers_in, search);
- if (!header) {
+ if (!header)
+ {
VV_error("Header %s not found", search);
header = apr_pstrdup(r->pool, "NULL");
}
@@ -150,12 +156,14 @@ static const char *vv_replace_HTTP(char *full __U__, char *search, request_rec *
return (header);
}
-static const char *vv_replace_ENV(char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_ENV(char *full __U__, char *search, request_rec *r)
+{
const char *env;
env = apr_table_get(r->subprocess_env, search);
- if (!env) {
+ if (!env)
+ {
VV_error("ENV %s not found", search);
env = apr_pstrdup(r->pool, "NULL");
}
@@ -163,13 +171,15 @@ static const char *vv_replace_ENV(char *full __U__, char *search, request_rec *r
return (env);
}
-static const char *vv_replace_SYM(char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_SYM(char *full __U__, char *search, request_rec *r)
+{
struct stat st;
char *real;
real = (char *)apr_palloc(r->pool, PATH_MAX * sizeof(char));
- if (search[0] != '/') {
+ if (search[0] != '/')
+ {
VV_error("Bad search: %s", search);
apr_cpystrn(real, "NULL", 5);
return (real);
@@ -177,14 +187,16 @@ static const char *vv_replace_SYM(char *full __U__, char *search, request_rec *r
real[0] = 0;
- if (lstat(search, &st) == -1) {
+ if (lstat(search, &st) == -1)
+ {
apr_cpystrn(real, "NULL", 5);
return (real);
}
realpath(search, real);
- if (lstat(real, &st) == -1) {
+ if (lstat(real, &st) == -1)
+ {
apr_cpystrn(real, "NULL", 5);
return (real);
}
@@ -192,7 +204,8 @@ static const char *vv_replace_SYM(char *full __U__, char *search, request_rec *r
return (real);
}
-char *vv_flat_arg(char *s1, request_rec *r) {
+char *vv_flat_arg(char *s1, request_rec *r)
+{
char *c, *end;
const char *s2;
@@ -205,16 +218,20 @@ char *vv_flat_arg(char *s1, request_rec *r) {
c = final + strlen(s1);
- while ((c = vv_strrrstr(final, c, "%{"))) {
+ while ((c = vv_strrrstr(final, c, "%{")))
+ {
end = strchr(c+2, '}');
- if (!end) {
+ if (!end)
+ {
VV_error("No end found for %s", c);
return NULL;
}
- for (i = tag_tab, s2 = NULL ; i->tag != NULL ; i++) {
- if (strncmp(c+2, i->tag, i->len) == 0) {
+ for (i = tag_tab, s2 = NULL ; i->tag != NULL ; i++)
+ {
+ if (strncmp(c+2, i->tag, i->len) == 0)
+ {
memcpy(&search, c+2 + i->len+1, end - (c+2 + i->len) -1);
search[end - (c+2 + i->len) -1] = '\0';
@@ -224,7 +241,8 @@ char *vv_flat_arg(char *s1, request_rec *r) {
}
}
- if (s2) {
+ if (s2)
+ {
memmove(c + strlen(s2), end + 1, strlen(c));
memcpy(c, s2, strlen(s2));
}
@@ -235,19 +253,22 @@ char *vv_flat_arg(char *s1, request_rec *r) {
return apr_pstrndup(r->pool, final, strlen(final));
}
-static void *vv_create_server_config(apr_pool_t *p, server_rec *s __U__) {
+static void *vv_create_server_config(apr_pool_t *p, server_rec *s __U__)
+{
virtualvalue_cfg_t *cfg = (virtualvalue_cfg_t *)apr_pcalloc(p, sizeof(virtualvalue_cfg_t));
return (void *)cfg;
}
-static void *vv_merge_server_config(apr_pool_t *p __U__, void *parent __U__, void *child) {
+static void *vv_merge_server_config(apr_pool_t *p __U__, void *parent __U__, void *child)
+{
virtualvalue_cfg_t *c_cfg = (virtualvalue_cfg_t *)child;
return (void *)c_cfg;
}
-static int vv_translate(request_rec *r) {
+static int vv_translate(request_rec *r)
+{
virtualvalue_cfg_t *c = (virtualvalue_cfg_t *)ap_get_module_config(r->server->module_config, &virtualvalue_module);
virtualvalue_var_t *n;
@@ -256,7 +277,8 @@ static int vv_translate(request_rec *r) {
n = c->vars;
- while (n) {
+ while (n)
+ {
n->handler(n->argc, n->argv, r);
n = (virtualvalue_var_t *)n->next;
@@ -266,12 +288,14 @@ static int vv_translate(request_rec *r) {
return (DECLINED);
}
-static const char *vv_set(cmd_parms *cmd, void *struct_ptr __U__, int argc, char *const argv[]) {
+static const char *vv_set(cmd_parms *cmd, void *struct_ptr __U__, int argc, char *const argv[])
+{
virtualvalue_cfg_t *c = (virtualvalue_cfg_t *)ap_get_module_config(cmd->server->module_config, &virtualvalue_module);
virtualvalue_var_t *n;
token_t *i;
- if (!c->enable) {
+ if (!c->enable)
+ {
VV_debug("c->enable: %d", c->enable);
return NULL;
}
@@ -286,36 +310,35 @@ static const char *vv_set(cmd_parms *cmd, void *struct_ptr __U__, int argc, char
n->tok = argv[0];
- for (i = token_tab ; i->tok != NULL ; i++) {
- if (strncmp(i->tok, n->tok, i->len) == 0) {
+ for (i = token_tab ; i->tok != NULL ; i++)
+ {
+ if (strncmp(i->tok, n->tok, i->len) == 0)
+ {
n->handler = i->func;
break;
}
}
- if (!n->handler) {
+ if (!n->handler)
return apr_pstrcat(cmd->pool, "Invalid Token ", argv[0], NULL);
- }
- if (!c->vars) {
+ if (!c->vars)
c->vars = n;
- }
- else {
+ else
vv_var_append(c->vars, n);
- }
/* Insert into n all argv without token already in n->tok */
n->argc = argc - 1;
n->argv = (char **)apr_palloc(cmd->pool, (n->argc + 1) * sizeof(char*));
- while (--argc > 0) { /* Or --argc >= 1, We don't need argv[0], as is tok */
+ while (--argc > 0) /* Or --argc >= 1, We don't need argv[0], as is tok */
n->argv[argc-1] = argv[argc];
- }
return NULL;
}
-static const char *vv_on(cmd_parms *cmd, void *struct_ptr __U__, int flag) {
+static const char *vv_on(cmd_parms *cmd, void *struct_ptr __U__, int flag)
+{
virtualvalue_cfg_t *cfg = (virtualvalue_cfg_t *)ap_get_module_config(cmd->server->module_config, &virtualvalue_module);
cfg->enable = (flag ? 1 : 0);
@@ -324,7 +347,8 @@ static const char *vv_on(cmd_parms *cmd, void *struct_ptr __U__, int flag) {
return NULL;
}
-static void register_hooks(apr_pool_t *p __U__) {
+static void register_hooks(apr_pool_t *p __U__)
+{
/* Theses modules need to be loaded *before* mod_virtualvalue */
static const char *const aszPre[] = {
"mod_alias.c",