Hello,
I don't understand how following loop can work
for (i = 0; &formData[i]; i++) {
}
from:
static int example_handler(request_rec *r){
/*~~~~~~~~~~~~~~~~~~~~~~*/
keyValuePair *formData;
/*~~~~~~~~~~~~~~~~~~~~~~*/
formData = readPost(r);
if (formData) {
int i;
for (i = 0; &formData[i]; i++) {
if (formData[i].key && formData[i].value) {
ap_rprintf(r, "%s = %s\n", formData[i].key, formData[i].value);
} else if (formData[i].key) {
ap_rprintf(r, "%s\n", formData[i].key);
} else if (formData[i].value) {
ap_rprintf(r, "= %s\n", formData[i].value);
} else {
break;
}
}
}
return OK;}
I tried to use this code in https://github.com/pierreforstmann/mod_plpgsql
but I could not
so I have modified it by just using the array entry number.
Can somebody explain to me why the array entry address is used ?
I tried to simplify this with following code that also does not work:
https://github.com/pierreforstmann/mcc/blob/ebabf5d2f784542d90a71825abb12506f3e64784/tal.c
Thanks.
I don't understand how following loop can work
for (i = 0; &formData[i]; i++) {
}
from:
static int example_handler(request_rec *r){
/*~~~~~~~~~~~~~~~~~~~~~~*/
keyValuePair *formData;
/*~~~~~~~~~~~~~~~~~~~~~~*/
formData = readPost(r);
if (formData) {
int i;
for (i = 0; &formData[i]; i++) {
if (formData[i].key && formData[i].value) {
ap_rprintf(r, "%s = %s\n", formData[i].key, formData[i].value);
} else if (formData[i].key) {
ap_rprintf(r, "%s\n", formData[i].key);
} else if (formData[i].value) {
ap_rprintf(r, "= %s\n", formData[i].value);
} else {
break;
}
}
}
return OK;}
I tried to use this code in https://github.com/pierreforstmann/mod_plpgsql
but I could not
so I have modified it by just using the array entry number.
Can somebody explain to me why the array entry address is used ?
I tried to simplify this with following code that also does not work:
https://github.com/pierreforstmann/mcc/blob/ebabf5d2f784542d90a71825abb12506f3e64784/tal.c
Thanks.