<pre class="prettyprint lang-c">static int example_handler(request_rec *r)
{
- const char* original = "You can't edit this!";
- char* copy;
- int* integers;
+ const char *original = "You can't edit this!";
+ char *copy;
+ int *integers;
/* Allocate space for 10 integer values and set them all to zero. */
integers = apr_pcalloc(r->pool, sizeof(int)*10);
/* Handler for the "exampleAction" directive */
/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
/* and we store it in a bit-wise manner. */
-const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2)
{
if(!strcasecmp(arg1, "file")) config.typeOfAction = 0x01;
else config.typeOfAction = 0x02;
/* Handler for the "exampleAction" directive */
/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
/* and we store it in a bit-wise manner. */
-const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2)
{
if(!strcasecmp(arg1, "file")) config.typeOfAction = 0x01;
else config.typeOfAction = 0x02;
configurations. We do so by creating the function we just referenced in
our name tag as the Per-directory configuration handler:</p>
-<pre class="prettyprint lang-c">void* create_dir_conf(apr_pool_t* pool, char* context) {
+<pre class="prettyprint lang-c">void *create_dir_conf(apr_pool_t *pool, char *context) {
context = context ? context : "(undefined context)";
example_config *cfg = apr_pcalloc(pool, sizeof(example_config));
if(cfg) {
/* Set some default values */
- strcpy(cfg->context, x);
+ strcpy(cfg->context, context);
cfg->enabled = 0;
cfg->path = "/foo/bar";
cfg->typeOfAction = 0x11;
-<pre class="prettyprint lang-c">void* merge_dir_conf(apr_pool_t* pool, void* BASE, void* ADD) {
- example_config* base = (example_config *) BASE ; /* This is what was set in the parent context */
- example_config* add = (example_config *) ADD ; /* This is what is set in the new context */
- example_config* conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
+<pre class="prettyprint lang-c">void *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD) {
+ example_config *base = (example_config *) BASE ; /* This is what was set in the parent context */
+ example_config *add = (example_config *) ADD ; /* This is what is set in the new context */
+ example_config *conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
/* Merge configurations */
conf->enabled = ( add->enabled == 0 ) ? base->enabled : add->enabled ;
<pre class="prettyprint lang-c">typedef struct {
- const char* key;
- const char* value;
+ const char *key;
+ const char *value;
} keyValuePair;
-keyValuePair* readPost(request_rec* r) {
+keyValuePair *readPost(request_rec *r) {
apr_array_header_t *pairs = NULL;
apr_off_t len;
apr_size_t size;
int res;
int i = 0;
char *buffer;
- keyValuePair* kvp;
+ keyValuePair *kvp;
res = ap_parse_form_data(r, NULL, &pairs, -1, HUGE_STRING_LEN);
if (res != OK || !pairs) return NULL; /* Return NULL if we failed or if there are is no POST data */
static int example_handler(request_rec *r)
{
/*~~~~~~~~~~~~~~~~~~~~~~*/
- keyValuePair* formData;
+ keyValuePair *formData;
/*~~~~~~~~~~~~~~~~~~~~~~*/
formData = readPost(r);
return(rc);
}
-static int example_handler(request_rec* r)
+static int example_handler(request_rec *r)
{
/*~~~~~~~~~~~~~~~~*/
apr_off_t size;
<highlight language="c">
static int example_handler(request_rec *r)
{
- const char* original = "You can't edit this!";
- char* copy;
- int* integers;
+ const char *original = "You can't edit this!";
+ char *copy;
+ int *integers;
/* Allocate space for 10 integer values and set them all to zero. */
integers = apr_pcalloc(r->pool, sizeof(int)*10);
/* Handler for the "exampleAction" directive */
/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
/* and we store it in a bit-wise manner. */
-const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2)
{
if(!strcasecmp(arg1, "file")) config.typeOfAction = 0x01;
else config.typeOfAction = 0x02;
/* Handler for the "exampleAction" directive */
/* Let's pretend this one takes one argument (file or db), and a second (deny or allow), */
/* and we store it in a bit-wise manner. */
-const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char* arg2)
+const char *example_set_action(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2)
{
if(!strcasecmp(arg1, "file")) config.typeOfAction = 0x01;
else config.typeOfAction = 0x02;
our name tag as the Per-directory configuration handler:</p>
<!-- BEGIN EXAMPLE CODE -->
<highlight language="c">
-void* create_dir_conf(apr_pool_t* pool, char* context) {
+void *create_dir_conf(apr_pool_t *pool, char *context) {
context = context ? context : "(undefined context)";
example_config *cfg = apr_pcalloc(pool, sizeof(example_config));
if(cfg) {
/* Set some default values */
- strcpy(cfg->context, x);
+ strcpy(cfg->context, context);
cfg->enabled = 0;
cfg->path = "/foo/bar";
cfg->typeOfAction = 0x11;
<!-- BEGIN EXAMPLE CODE -->
<highlight language="c">
-void* merge_dir_conf(apr_pool_t* pool, void* BASE, void* ADD) {
- example_config* base = (example_config *) BASE ; /* This is what was set in the parent context */
- example_config* add = (example_config *) ADD ; /* This is what is set in the new context */
- example_config* conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
+void *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD) {
+ example_config *base = (example_config *) BASE ; /* This is what was set in the parent context */
+ example_config *add = (example_config *) ADD ; /* This is what is set in the new context */
+ example_config *conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
/* Merge configurations */
conf->enabled = ( add->enabled == 0 ) ? base->enabled : add->enabled ;
<!-- BEGIN EXAMPLE CODE -->
<highlight language="c">
typedef struct {
- const char* key;
- const char* value;
+ const char *key;
+ const char *value;
} keyValuePair;
-keyValuePair* readPost(request_rec* r) {
+keyValuePair *readPost(request_rec *r) {
apr_array_header_t *pairs = NULL;
apr_off_t len;
apr_size_t size;
int res;
int i = 0;
char *buffer;
- keyValuePair* kvp;
+ keyValuePair *kvp;
res = ap_parse_form_data(r, NULL, &pairs, -1, HUGE_STRING_LEN);
if (res != OK || !pairs) return NULL; /* Return NULL if we failed or if there are is no POST data */
static int example_handler(request_rec *r)
{
/*~~~~~~~~~~~~~~~~~~~~~~*/
- keyValuePair* formData;
+ keyValuePair *formData;
/*~~~~~~~~~~~~~~~~~~~~~~*/
formData = readPost(r);
return(rc);
}
-static int example_handler(request_rec* r)
+static int example_handler(request_rec *r)
{
/*~~~~~~~~~~~~~~~~*/
apr_off_t size;