You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Joe Schaefer <jo...@sunstarsys.com> on 2003/04/17 23:28:34 UTC
apreq-2 status update
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co httpd-apreq-2
% cd httpd-apreq-2
% ./buildconf
% ./configure --with-apache2-apxs=/path/to/apache2/bin/apxs
% make
% make test && make install
should install the mod_apreq filter (and activate it in httpd.conf).
I'll update the STATUS file shortly to detail the state of the current
repository: the good news is that the core API (src/ directory) is
fairly stable now. I'll be adding unit tests to t/ to flesh out some
bugs in the core, but I think it's now time for folks to start
contemplating the perl & tcl glue.
Also, if anybody wants to start souping up the filter api, the file to
play with is env/mod_apreq.c. I also started working on the cgi
environment (env/libapreq_cgi.c), but in the near term, I am not
planning to continue working on it. OTOH, I'll happily apply patches to
it :-)
--
Joe Schafer
Re: apreq-2 status update
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 18 Apr 2003, Stas Bekman wrote:
>
>
>>Joe Schaefer wrote:
>>
>>>Stas Bekman <st...@stason.org> writes:
>>>[...]
>>>
>>>>Is it just me or others don't get apreq2 cvs commit emails? I thought
>>>>it was on the same list as apreq1, no?
>>>
>>>I'm getting them on the (same) apreq-cvs list. They're also showing
>>>up in the list archive at
>>>
>>> http://marc.theaimsgroup.com/?l=apreq-cvs&r=1&b=200304&w=2
>>
>>That's amazing, if they are getting posted to the same list and
>>I do get the posts for httpd-apreq changes but not for
>>httpd-apreq-2. Any ideas why?
>>
>>Do other people get httpd-apreq-2 cvs commit emails?
>
>
> I'm receiving them OK ...
Thanks Randy. Mistery resolved. I've had a procmail rule:
:0
* ^TO.*cvs@httpd.apache.org
httpd-2.0-cvs
which was picking the apreq 2 cvs commits and I don't read that folder very
often ;) Now fixed.
Thanks for the sanity check!
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: apreq-2 status update
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 18 Apr 2003, Stas Bekman wrote:
> Joe Schaefer wrote:
> > Stas Bekman <st...@stason.org> writes:
> > [...]
> >>Is it just me or others don't get apreq2 cvs commit emails? I thought
> >>it was on the same list as apreq1, no?
> > I'm getting them on the (same) apreq-cvs list. They're also showing
> > up in the list archive at
> >
> > http://marc.theaimsgroup.com/?l=apreq-cvs&r=1&b=200304&w=2
>
> That's amazing, if they are getting posted to the same list and
> I do get the posts for httpd-apreq changes but not for
> httpd-apreq-2. Any ideas why?
>
> Do other people get httpd-apreq-2 cvs commit emails?
I'm receiving them OK ...
--
best regards,
randy
Re: apreq-2 status update
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
>
> [...]
>
>
>>Is it just me or others don't get apreq2 cvs commit emails? I thought
>>it was on the same list as apreq1, no?
>
>
> I'm getting them on the (same) apreq-cvs list. They're also showing
> up in the list archive at
>
> http://marc.theaimsgroup.com/?l=apreq-cvs&r=1&b=200304&w=2
That's amazing, if they are getting posted to the same list and I do get the
posts for httpd-apreq changes but not for httpd-apreq-2. Any ideas why?
Do other people get httpd-apreq-2 cvs commit emails?
I wasn't aware that httpd-apreq-2 had any commits at all :(
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: apreq-2 status update
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:
[...]
> Is it just me or others don't get apreq2 cvs commit emails? I thought
> it was on the same list as apreq1, no?
I'm getting them on the (same) apreq-cvs list. They're also showing
up in the list archive at
http://marc.theaimsgroup.com/?l=apreq-cvs&r=1&b=200304&w=2
--
Joe Schaefer
Re: apreq-2 status update
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> % cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
> % cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co httpd-apreq-2
> % cd httpd-apreq-2
> % ./buildconf
> % ./configure --with-apache2-apxs=/path/to/apache2/bin/apxs
> % make
> % make test && make install
>
> should install the mod_apreq filter (and activate it in httpd.conf).
> I'll update the STATUS file shortly to detail the state of the current
> repository: the good news is that the core API (src/ directory) is
> fairly stable now. I'll be adding unit tests to t/ to flesh out some
> bugs in the core, but I think it's now time for folks to start
> contemplating the perl & tcl glue.
Great work, Joe!
Is it just me or others don't get apreq2 cvs commit emails? I thought it was
on the same list as apreq1, no?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: apreq-2 status update
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
>
> [...]
>
>
>>as you can see, the output of --cflags is not there, my --ccflags gives:
>>
>>/home/stas/httpd/prefork/bin/apr-config --cflags --libs
>>-g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
>>-pthread -lm -lcrypt -lnsl -ldl
>>
>>However you should probably use --ldflags for the linking stage, but I get an
>>empty string when I retrieve these. Looks like a bug in apr?
>>
>
>
> That's my guess- I'd guess the bug is somewhere in apr-config.
but that doesn't help :( the build won't work.
> (I've been using cvs HEAD for httpd-2.0, if it matters).
Ah, be careful, 'cvs HEAD' is not httpd-2.0, but httpd-2.1. The right version
to use is 2.0, which can be checked out using the APACHE_2_0_BRANCH branch.
See: http://httpd.apache.org/dev/devnotes.html
> OK, for kicks I just added a test handler to mod_apreq.c. If you
> can get current cvs to compile and install, try adding something like
>
> <Location "/apreq">
> SetHandler httpd-apreq
> </Location>
>
> to httpd.conf and firing some GETs and POSTs at it. The mfd parser
> code is probably broken since I haven't tried testing it yet, but
> an urlencoded POST should work ok.
Cool, gotta go now, will try that tomorrow.
p.s. any plans for adding Apache::Test suite? Ideally we should be able to
re-use tests from apreq1 at apreq2.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: apreq-2 status update
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:
[...]
> as you can see, the output of --cflags is not there, my --ccflags gives:
>
> /home/stas/httpd/prefork/bin/apr-config --cflags --libs
> -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
> -pthread -lm -lcrypt -lnsl -ldl
>
> However you should probably use --ldflags for the linking stage, but I get an
> empty string when I retrieve these. Looks like a bug in apr?
>
That's my guess- I'd guess the bug is somewhere in apr-config.
(I've been using cvs HEAD for httpd-2.0, if it matters).
OK, for kicks I just added a test handler to mod_apreq.c. If you
can get current cvs to compile and install, try adding something like
<Location "/apreq">
SetHandler httpd-apreq
</Location>
to httpd.conf and firing some GETs and POSTs at it. The mfd parser
code is probably broken since I haven't tried testing it yet, but
an urlencoded POST should work ok.
--
Joe Schaefer
Re: apreq-2 status update
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
>>For some reason -lpthread wasn't added by configure. After
>>manually adding it, all tests pass.
>
>
> Weird.
>
> % /home/joe/apache2/bin/apr-config --cflags --libs
> -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread -lm -lcrypt -lnsl -ldl
>
> My apr-config lists "-pthread" in the --cflags as well, which seems to
> work on my machine (RH 8). How current is your apxs script? Does line
> 471 look like this (httpd-2.0/support/apxs.in revision 1.54):
>
> my $apr_libs=`$apr_bindir/apr-config --cflags --ldflags --link-libtool --libs`;
>
> It looks like the (undocumented) -p flag for apxs was added in
> revision 1.46 (2002/09/19), so maybe it's in need of additional
> work on your platform.
that's right, but the problem is during the linking, not compilation.
I get the problem in:
cd t
/home/stas/httpd/prefork/build/libtool --silent --mode=link gcc -o testall
-lapreq /home/stas/httpd/prefork/lib/libaprutil-0.la -lgdbm -ldb -lexpat
/home/stas/httpd/prefork/lib/libapr-0.la -lm -lcrypt -lnsl -ldl testall.o
libapreq_tests.a -L../src
/home/stas/httpd/prefork/lib/libapr-0.so: undefined reference to `pthread_create'
... lots of these
as you can see, the output of --cflags is not there, my --ccflags gives:
/home/stas/httpd/prefork/bin/apr-config --cflags --libs
-g -O2 -Wall -Wmissing-prototypes
-Wstrict-prototypes -Wmissing-declarations -pthread -lm -lcrypt -lnsl -ldl
However you should probably use --ldflags for the linking stage, but I get an
empty string when I retrieve these. Looks like a bug in apr?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [apreq-2] conditionals
Posted by "David N. Welton" <da...@dedasys.com>.
Joe Schaefer <jo...@sunstarsys.com> writes:
> Cool, but I'd rather see that written this way
>
> if (a > 0)
> c = 3;
> else
> d = 3;
+1 - it increases readability. I don't like using the ternary
operator where it too makes the code easier to read, and there aren't
that many cases where that is true.
--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/
Re: [apreq-2] cookie_bake vs bake_cookie?
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
> For apreq-2, in src/, apreq_cookie.h declares
> apreq_cookie_bake() and apreq_cookie_bake2(), whereas
> apreq_cookie.c has apreq_bake_cookie() and apreq_bake2_cookie().
> This diff:
> ===========================================================
> Index: apreq_cookie.c
> ===================================================================
> RCS file: /home/cvs/httpd-apreq-2/src/apreq_cookie.c,v
> retrieving revision 1.14
> diff -u -r1.14 apreq_cookie.c
> --- apreq_cookie.c 7 Jun 2003 20:07:41 -0000 1.14
> +++ apreq_cookie.c 9 Jun 2003 06:00:43 -0000
> @@ -478,7 +478,7 @@
> return NULL;
> }
>
> -APREQ_DECLARE(apr_status_t) apreq_bake_cookie(const apreq_cookie_t *c,
> +APREQ_DECLARE(apr_status_t) apreq_cookie_bake(const apreq_cookie_t *c,
> void *env)
> {
> char *s = apreq_cookie_as_string(apreq_env_pool(env),c);
> @@ -493,7 +493,7 @@
> return apreq_env_set_cookie(env, s);
> }
>
> -APREQ_DECLARE(apr_status_t) apreq_bake2_cookie(const apreq_cookie_t *c,
> +APREQ_DECLARE(apr_status_t) apreq_cookie_bake2(const apreq_cookie_t *c,
> void *env)
> {
> char *s = apreq_cookie_as_string(apreq_env_pool(env),c);
> ====================================================================
OOPS. It should be apreq_cookie_bake* to better match
the Perl api.
Thanks Randy, applied.
--
Joe Schaefer
[apreq-2] cookie_bake vs bake_cookie?
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
For apreq-2, in src/, apreq_cookie.h declares
apreq_cookie_bake() and apreq_cookie_bake2(), whereas
apreq_cookie.c has apreq_bake_cookie() and apreq_bake2_cookie().
This diff:
===========================================================
Index: apreq_cookie.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq_cookie.c,v
retrieving revision 1.14
diff -u -r1.14 apreq_cookie.c
--- apreq_cookie.c 7 Jun 2003 20:07:41 -0000 1.14
+++ apreq_cookie.c 9 Jun 2003 06:00:43 -0000
@@ -478,7 +478,7 @@
return NULL;
}
-APREQ_DECLARE(apr_status_t) apreq_bake_cookie(const apreq_cookie_t *c,
+APREQ_DECLARE(apr_status_t) apreq_cookie_bake(const apreq_cookie_t *c,
void *env)
{
char *s = apreq_cookie_as_string(apreq_env_pool(env),c);
@@ -493,7 +493,7 @@
return apreq_env_set_cookie(env, s);
}
-APREQ_DECLARE(apr_status_t) apreq_bake2_cookie(const apreq_cookie_t *c,
+APREQ_DECLARE(apr_status_t) apreq_cookie_bake2(const apreq_cookie_t *c,
void *env)
{
char *s = apreq_cookie_as_string(apreq_env_pool(env),c);
====================================================================
changes the definitions in apreq_cookie.c to agree with the
declarations in apreq_cookie.h.
--
best regards,
randy kobes
Re: [apreq-2] conditionals
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
> On 19 Apr 2003, Joe Schaefer wrote:
>
> [ .. ]
> > Actually, all the suggestions you made today are fine
> > with me except for the strcasecmp one. I put the t->cmp
> > (mis)feature in way before the tables were implemented, and
> > now I'd rather see it pulled out entirely. IMO we should
> > just use strcasecmp whereever t->cmp is used in the
> > apreq_tables.c source.
>
> Something like the following?
[...patch..]
Yup, exactly what I had in mind. Thanks alot, Randy!
--
Joe Schaefer
Re: [apreq-2] conditionals
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On 19 Apr 2003, Joe Schaefer wrote:
[ .. ]
> Actually, all the suggestions you made today are fine
> with me except for the strcasecmp one. I put the t->cmp
> (mis)feature in way before the tables were implemented, and
> now I'd rather see it pulled out entirely. IMO we should
> just use strcasecmp whereever t->cmp is used in the
> apreq_tables.c source.
Something like the following?
==============================================================
Index: apreq_tables.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_tables.c,v
retrieving revision 1.14
diff -u -r1.14 apreq_tables.c
--- apreq_tables.c 20 Apr 2003 03:37:45 -0000 1.14
+++ apreq_tables.c 20 Apr 2003 04:16:09 -0000
@@ -112,10 +112,6 @@
#define UNLOCK_TREE(t,n)
#define TREE_IS_LOCKED(t,n)
-
-/* This may someday become public, but has hash+tree harmony embedded. */
-typedef int (apreq_table_cmp_t)(const char *, const char *);
-
#define TF_MERGE 1
#define TF_BALANCE 2
#define TF_LOCK 4
@@ -125,8 +121,6 @@
apr_array_header_t a;
int ghosts;
- apreq_table_cmp_t *cmp;
-
apreq_value_copy_t *copy;
apreq_value_merge_t *merge;
@@ -188,8 +182,7 @@
}
-static APR_INLINE int search(apreq_table_cmp_t *cmp,
- apreq_table_entry_t *o,
+static APR_INLINE int search(apreq_table_entry_t *o,
int *elt,
const char *key)
{
@@ -197,7 +190,7 @@
if ( idx < 0)
return 0;
while (1) {
- int direction = (*cmp)(key,idx[o].key);
+ int direction = strcasecmp(key,idx[o].key);
if (direction < 0 && idx[o].tree[LEFT] >= 0)
idx = idx[o].tree[LEFT];
@@ -218,13 +211,12 @@
#define TREE_POP 1
#define TREE_DROP 2
-static int insert(apreq_table_cmp_t *cmp,
- apreq_table_entry_t *o, int *root, int x,
+static int insert(apreq_table_entry_t *o, int *root, int x,
apreq_table_entry_t *elt,
unsigned flags )
{
int idx = elt - o;
- int s = search(cmp, o, &x, elt->key);
+ int s = search(o, &x, elt->key);
if (s == 0) { /* found */
if (x < 0) { /* empty tree */
@@ -436,8 +428,7 @@
x[o].color = BLACK;
}
-static int combine(apreq_table_cmp_t *cmp,
- apreq_table_entry_t *o, int a,
+static int combine(apreq_table_entry_t *o, int a,
int b, const int n)
{
int left, right, next;
@@ -461,23 +452,23 @@
a[o].tree[PARENT] = -1;
}
- if (insert(cmp,o,&a,a,b+o, TREE_PUSH) < 0)
+ if (insert(o,&a,a,b+o, TREE_PUSH) < 0)
rv = b;
if (b[o].tree[PARENT] >= 0)
PROMOTE(o,&a,b);
b[o].tree[PARENT] = parent;
- b[o].tree[LEFT] = combine(cmp, o, b[o].tree[LEFT], left, n);
- b[o].tree[RIGHT] = combine(cmp, o, b[o].tree[RIGHT], right, n);
+ b[o].tree[LEFT] = combine(o, b[o].tree[LEFT], left, n);
+ b[o].tree[RIGHT] = combine(o, b[o].tree[RIGHT], right, n);
return rv;
}
else {
if (b[o].tree[PARENT] >= 0)
b[o].tree[PARENT] += n;
- b[o].tree[LEFT] = combine(cmp, o, -1, left, n);
- b[o].tree[RIGHT] = combine(cmp, o, -1, right, n);
+ b[o].tree[LEFT] = combine(o, -1, left, n);
+ b[o].tree[RIGHT] = combine(o, -1, right, n);
return b;
}
@@ -567,7 +558,6 @@
/* XXX: is memset(*,-1,*) portable ??? */
memset(t->root, -1, TABLE_HASH_SIZE * sizeof(int));
- t->cmp = strcasecmp;
t->merge = apreq_merge_values;
t->copy = apreq_copy_value;
t->flags = 0;
@@ -596,7 +586,6 @@
memcpy(new->root, t->root, TABLE_HASH_SIZE * sizeof(int));
new->merge = t->merge;
new->copy = t->copy;
- new->cmp = t->cmp;
new->flags=t->flags;
return new;
}
@@ -688,7 +677,7 @@
memset(t->root,-1,TABLE_HASH_SIZE * sizeof(int));
for (idx = 0; idx < t->a.nelts; ++idx)
- insert(t->cmp, o, &t->root[TABLE_HASH(idx[o].key)], -1, &idx[o],
+ insert(o, &t->root[TABLE_HASH(idx[o].key)], -1, &idx[o],
TF_BALANCE | TREE_PUSH);
t->flags |= TF_BALANCE;
@@ -842,7 +831,7 @@
int idx = t->root[TABLE_HASH(key)];
apreq_table_entry_t *o = (apreq_table_entry_t *)t->a.elts;
- if ( idx < 0 || search(t->cmp,o,&idx,key) )
+ if ( idx < 0 || search(o,&idx,key) )
return NULL;
return v2c(idx[o].val);
@@ -855,7 +844,7 @@
int idx = *root;
apreq_table_entry_t *o = (apreq_table_entry_t *)t->a.elts;
- if ( idx < 0 || search(t->cmp,o,&idx,key) )
+ if ( idx < 0 || search(o,&idx,key) )
return NULL;
if (idx != *root) {
@@ -883,7 +872,7 @@
}
else {
idx = t->root[TABLE_HASH(key)];
- if ( idx>=0 && search(t->cmp,o,&idx,key) == 0 )
+ if ( idx>=0 && search(o,&idx,key) == 0 )
for ( ; idx>=0; idx = idx[o].tree[NEXT] )
*(const apreq_value_t **)apr_array_push(a) = idx[o].val;
}
@@ -908,7 +897,7 @@
}
#endif
- if (idx >= 0 && search(t->cmp,o,&idx,key) == 0) {
+ if (idx >= 0 && search(o,&idx,key) == 0) {
int n;
idx[o].val = val;
@@ -922,7 +911,7 @@
e->key = key;
e->val = val;
e->tree[NEXT] = -1;
- insert(t->cmp,(apreq_table_entry_t *)t->a.elts,
+ insert((apreq_table_entry_t *)t->a.elts,
&t->root[TABLE_HASH(key)],idx,e,TREE_PUSH);
}
}
@@ -932,7 +921,7 @@
int idx = t->root[TABLE_HASH(key)];
apreq_table_entry_t *o = (apreq_table_entry_t *)t->a.elts;
- if (idx >= 0 && search(t->cmp,o,&idx,key) == 0) {
+ if (idx >= 0 && search(o,&idx,key) == 0) {
int n;
LOCK_TABLE(t);
@@ -959,7 +948,7 @@
apreq_table_entry_t *e;
- if (idx >= 0 && search(t->cmp,o,&idx,val->name) == 0) {
+ if (idx >= 0 && search(o,&idx,val->name) == 0) {
int n;
apreq_value_t *a[APREQ_NELTS];
apr_array_header_t arr = { t->a.pool, sizeof(apreq_value_t *), 0,
@@ -998,7 +987,7 @@
e->key = val->name;
e->val = val;
e->tree[NEXT] = -1;
- insert(t->cmp,(apreq_table_entry_t *)t->a.elts,
+ insert((apreq_table_entry_t *)t->a.elts,
&t->root[TABLE_HASH(key)],idx,e,TREE_PUSH);
}
return val->status;
@@ -1030,7 +1019,7 @@
elt->key = val->name;
elt->val = val;
elt->tree[NEXT] = -1;
- insert(t->cmp, o, root, *root, elt, TREE_PUSH);
+ insert(o, root, *root, elt, TREE_PUSH);
return APR_SUCCESS;
}
@@ -1084,14 +1073,14 @@
else if ( idx[o].tree[PARENT] >= 0 ||
s->root[hash] == idx-n )
{
- insert(t->cmp, o, &t->root[hash], t->root[hash], idx+o,
+ insert(o, &t->root[hash], t->root[hash], idx+o,
TREE_PUSH | TF_BALANCE);
}
}
}
else {
for (idx = 0; idx < TABLE_HASH_SIZE; ++idx)
- t->root[idx] = combine(t->cmp, o,t->root[idx],s->root[idx],n);
+ t->root[idx] = combine(o,t->root[idx],s->root[idx],n);
}
UNLOCK_TABLE(t);
@@ -1120,13 +1109,9 @@
}
#endif
- if (overlay->cmp != base->cmp)
- return NULL;
-
t->a.pool = p;
t->a.elt_size = sizeof(apreq_table_entry_t);
t->copy = overlay->copy;
- t->cmp = overlay->cmp;
t->merge = overlay->merge;
t->flags = overlay->flags & base->flags;
t->ghosts = overlay->ghosts;
@@ -1164,9 +1149,6 @@
if (m + n == 0)
return APR_SUCCESS;
- if ( a->cmp != b->cmp)
- return APR_EMISMATCH;
-
/* copy (extend) a using b's pool */
if (a->a.pool != p) {
make_array_core(&a->a, p, m+n, sizeof(apreq_table_entry_t), 0);
@@ -1360,7 +1342,7 @@
int rv = 1, idx;
if (argp) { /* Scan for entries that match the next key */
idx = t->root[TABLE_HASH(argp)];
- if ( search(t->cmp,o,&idx,argp) == 0 )
+ if ( search(o,&idx,argp) == 0 )
while (idx >= 0) {
rv = (*comp) (rec, idx[o].key, v2c(idx[o].val));
idx = idx[o].tree[NEXT];
======================================================================
--
best regards,
randy
Re: [apreq-2] apreq.c warning
Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
>
> [...]
>
>
>>Or, alternatively use:
>>
>>- APREQ_DECLARE(long) apreq_atol(const char *s)
>>+ APREQ_DECLARE(apr_int64_t) apreq_atol(const char *s)
>>
>>it's probably better to stick to apr types, rather than convert back
>>and force.
>
>
> OOPS- I already incorporated Randy's patch into the latest commit.
> I do agree that the apr_int64_t return type would be better here.
>
>
>>Of course this will require to adjust the types in the callers of this
>>function...
>
>
> Can anyone suggest some better names for apreq_atoi and apreq_atol?
> They're identical functions except for their trailing character
> interpretations (file sizes vs dates).
it seems that it's the easiest to use the real return type in the name
I'd go for 'apreq_a2int64', but 'apreq_atoint64' is probably closer to atoi
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [apreq-2] apreq.c warning
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:
[...]
> Or, alternatively use:
>
> - APREQ_DECLARE(long) apreq_atol(const char *s)
> + APREQ_DECLARE(apr_int64_t) apreq_atol(const char *s)
>
> it's probably better to stick to apr types, rather than convert back
> and force.
OOPS- I already incorporated Randy's patch into the latest commit.
I do agree that the apr_int64_t return type would be better here.
> Of course this will require to adjust the types in the callers of this
> function...
Can anyone suggest some better names for apreq_atoi and apreq_atol?
They're identical functions except for their trailing character
interpretations (file sizes vs dates).
--
Joe Schaefer
Re: [apreq-2] apreq.c warning
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> The following diff:
>
> ===================================================
> Index: apreq.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-apreq-2/src/apreq.c,v
> retrieving revision 1.12
> diff -u -r1.12 apreq.c
> --- apreq.c 19 Apr 2003 09:42:08 -0000 1.12
> +++ apreq.c 20 Apr 2003 04:02:32 -0000
> @@ -166,11 +166,11 @@
>
> APREQ_DECLARE(long) apreq_atol(const char *s)
> {
> - apr_int64_t n = 0;
> + long n = 0;
> char *p;
> if (s == NULL)
> return 0;
> - n = apr_strtoi64(s, &p, 0); /* XXX: what about overflow? */
> + n = (long) apr_strtoi64(s, &p, 0); /* XXX: what about overflow? */
>
> if (p == NULL)
> return n;
> ===============================================================
> avoids warnings about a conversion from __int64 to long with
> VC++ on Win32.
Or, alternatively use:
- APREQ_DECLARE(long) apreq_atol(const char *s)
+ APREQ_DECLARE(apr_int64_t) apreq_atol(const char *s)
it's probably better to stick to apr types, rather than convert back and force.
Of course this will require to adjust the types in the callers of this function...
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
[apreq-2] apreq.c warning
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
The following diff:
===================================================
Index: apreq.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.12
diff -u -r1.12 apreq.c
--- apreq.c 19 Apr 2003 09:42:08 -0000 1.12
+++ apreq.c 20 Apr 2003 04:02:32 -0000
@@ -166,11 +166,11 @@
APREQ_DECLARE(long) apreq_atol(const char *s)
{
- apr_int64_t n = 0;
+ long n = 0;
char *p;
if (s == NULL)
return 0;
- n = apr_strtoi64(s, &p, 0); /* XXX: what about overflow? */
+ n = (long) apr_strtoi64(s, &p, 0); /* XXX: what about overflow? */
if (p == NULL)
return n;
===============================================================
avoids warnings about a conversion from __int64 to long with
VC++ on Win32.
--
best regards,
randy
Re: [apreq-2] conditionals
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
[...]
> Ah - thanks for pointing that out. The error I'm getting with
> something like
> (a > 0) ? c : d = 3;
> or
> (a > 0 ? c : d) = 3;
> is
> '=' : left operand must be l-value
^^^^^^^^^^^^^^^^^^^^^^^^^^^
OOPS. My mistake :-(
> What does work is
> (a > 0) ? (c=3) : (d=3);
Cool, but I'd rather see that written this way
if (a > 0)
c = 3;
else
d = 3;
I'd rather convert the bogus ?: lines to that format.
Randy, if you agree that this is better, please make
the commit.
Actually, all the suggestions you made today are fine
with me except for the strcasecmp one. I put the t->cmp
(mis)feature in way before the tables were implemented, and
now I'd rather see it pulled out entirely. IMO we should
just use strcasecmp whereever t->cmp is used in the
apreq_tables.c source.
--
Joe Schaefer
Re: [apreq-2] conditionals
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On 19 Apr 2003, Joe Schaefer wrote:
> Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
> [...]
>
> > - (parent >= 0) ? parent[o].tree[LR(pivot)] : *root = child;
> > + (parent >= 0) ? parent[o].tree[LR(pivot)] : (*root = child);
>
> Those aren't equivalent. The first one uses ?: to select the
> lvalue - IOW it's doing this
>
> ( parent >= 0 ? parent[o].tree[LR(pivot)] : *root ) = child;
>
> or at least it should be, since that's what I want to have
> happen here.
Ah - thanks for pointing that out. The error I'm getting with
something like
(a > 0) ? c : d = 3;
or
(a > 0 ? c : d) = 3;
is
'=' : left operand must be l-value
What does work is
(a > 0) ? (c=3) : (d=3);
--
best regards,
randy kobes
Re: [apreq-2] conditionals
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
[...]
> - (parent >= 0) ? parent[o].tree[LR(pivot)] : *root = child;
> + (parent >= 0) ? parent[o].tree[LR(pivot)] : (*root = child);
Those aren't equivalent. The first one uses ?: to select the
lvalue - IOW it's doing this
( parent >= 0 ? parent[o].tree[LR(pivot)] : *root ) = child;
or at least it should be, since that's what I want to have
happen here.
--
Joe Schaefer
Re: [apreq-2] conditionals
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sat, 19 Apr 2003, Randy Kobes wrote:
> For apreq-2, VC++ on Win32 (and perhaps also some other
> compilers?) doesn't like statements like
> (some_condition) ? do_something : do_something_else;
> This diff (unfortunately :)
[ .. ]
Bill pointed out a better solution:
=========================================================
Index: apreq_tables.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_tables.c,v
retrieving revision 1.13
diff -u -r1.13 apreq_tables.c
--- apreq_tables.c 19 Apr 2003 16:21:31 -0000 1.13
+++ apreq_tables.c 19 Apr 2003 20:54:35 -0000
@@ -176,7 +176,7 @@
if (pivot[o].tree[!direction] >= 0)
pivot[o].tree[!direction][o].tree[PARENT] = pivot;
- (parent >= 0) ? parent[o].tree[LR(pivot)] : *root = child;
+ (parent >= 0) ? parent[o].tree[LR(pivot)] : (*root = child);
child[o].tree[PARENT] = parent;
child[o].tree[direction] = pivot;
@@ -256,7 +256,7 @@
if (x[o].tree[RIGHT] >= 0)
x[o].tree[RIGHT][o].tree[PARENT] = idx;
- (parent >= 0) ? parent[o].tree[LR(x)] : *root = idx;
+ (parent >= 0) ? parent[o].tree[LR(x)] : (*root = idx);
elt->tree[PARENT] = parent;
elt->tree[RIGHT] = x[o].tree[RIGHT];
@@ -333,7 +333,7 @@
y[o].tree[RIGHT] = idx[o].tree[RIGHT];
y[o].color = idx[o].color;
- (x >= 0) ? x[o].tree[LR(idx)] : *root = y;
+ (x >= 0) ? x[o].tree[LR(idx)] : (*root = y);
idx[o].tree[PARENT] = -1;
idx[o].tree[LEFT] = -1;
@@ -357,7 +357,7 @@
x[o].tree[PARENT] = y[o].tree[PARENT];
(y[o].tree[PARENT] >= 0) ?
- y[o].tree[PARENT][o].tree[LR(y)] : *root = x;
+ y[o].tree[PARENT][o].tree[LR(y)] : (*root = x);
if (y != idx) { /* swap y[o] with idx[o] */
y[o].tree[LEFT] = idx[o].tree[LEFT];
@@ -365,7 +365,7 @@
y[o].tree[PARENT] = idx[o].tree[PARENT];
(y[o].tree[PARENT] >= 0) ?
- y[o].tree[PARENT][o].tree[LR(y)] : *root = y;
+ y[o].tree[PARENT][o].tree[LR(y)] : (*root = y);
idx[o].tree[LEFT] = -1;
idx[o].tree[RIGHT] = -1;
================================================================
--
best regards,
randy
[apreq-2] conditionals
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
For apreq-2, VC++ on Win32 (and perhaps also some other
compilers?) doesn't like statements like
(some_condition) ? do_something : do_something_else;
This diff (unfortunately :)
=========================================================
Index: apreq_tables.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_tables.c,v
retrieving revision 1.13
diff -u -r1.13 apreq_tables.c
--- apreq_tables.c 19 Apr 2003 16:21:31 -0000 1.13
+++ apreq_tables.c 19 Apr 2003 19:42:18 -0000
@@ -176,7 +176,12 @@
if (pivot[o].tree[!direction] >= 0)
pivot[o].tree[!direction][o].tree[PARENT] = pivot;
- (parent >= 0) ? parent[o].tree[LR(pivot)] : *root = child;
+ if (parent >= 0) {
+ parent[o].tree[LR(pivot)];
+ }
+ else {
+ *root = child;
+ }
child[o].tree[PARENT] = parent;
child[o].tree[direction] = pivot;
@@ -256,7 +261,12 @@
if (x[o].tree[RIGHT] >= 0)
x[o].tree[RIGHT][o].tree[PARENT] = idx;
- (parent >= 0) ? parent[o].tree[LR(x)] : *root = idx;
+ if (parent >= 0) {
+ parent[o].tree[LR(x)];
+ }
+ else {
+ *root = idx;
+ }
elt->tree[PARENT] = parent;
elt->tree[RIGHT] = x[o].tree[RIGHT];
@@ -333,7 +343,12 @@
y[o].tree[RIGHT] = idx[o].tree[RIGHT];
y[o].color = idx[o].color;
- (x >= 0) ? x[o].tree[LR(idx)] : *root = y;
+ if (x >= 0) {
+ x[o].tree[LR(idx)];
+ }
+ else {
+ *root = y;
+ }
idx[o].tree[PARENT] = -1;
idx[o].tree[LEFT] = -1;
@@ -356,16 +371,24 @@
/* remove y from the parent chain */
x[o].tree[PARENT] = y[o].tree[PARENT];
- (y[o].tree[PARENT] >= 0) ?
- y[o].tree[PARENT][o].tree[LR(y)] : *root = x;
+ if (y[o].tree[PARENT] >= 0) {
+ y[o].tree[PARENT][o].tree[LR(y)];
+ }
+ else {
+ *root = x;
+ }
if (y != idx) { /* swap y[o] with idx[o] */
y[o].tree[LEFT] = idx[o].tree[LEFT];
y[o].tree[RIGHT] = idx[o].tree[RIGHT];
y[o].tree[PARENT] = idx[o].tree[PARENT];
- (y[o].tree[PARENT] >= 0) ?
- y[o].tree[PARENT][o].tree[LR(y)] : *root = y;
+ if (y[o].tree[PARENT] >= 0) {
+ y[o].tree[PARENT][o].tree[LR(y)];
+ }
+ else {
+ *root = y;
+ }
idx[o].tree[LEFT] = -1;
idx[o].tree[RIGHT] = -1;
================================================================
allows apreq_tables.c to compile.
--
best regards,
randy
Re: [apreq-2] order of declarations
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> Problem solved, I think ... This recent commit
> -#define apreq_env_content_type(c) APREQ_ENV.in(c, "Content-Type");
[...]
> to now compile fine - I guess it was the extraneous ';' at
> the end of the #define for apreq_env_content_type() that was
> confusing VC++.
Ah, of course ;)
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [apreq-2] order of declarations
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 23 Apr 2003, Stas Bekman wrote:
[ .. ]
> What happens if you do this:
>
> #define foo(c) APREQ_ENV.in(c, "Content-Type")
> if (parser->v.size == 0) {
> const char *bdry, *ct = foo(req->env);
> apr_size_t blen;
Problem solved, I think ... This recent commit
================================================================
Index: apreq_env.h
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_env.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- apreq_env.h 12 Apr 2003 15:42:11 -0000 1.9
+++ apreq_env.h 22 Apr 2003 21:00:13 -0000 1.10
@@ -89,7 +89,7 @@
#define apreq_env_config(c) APREQ_ENV.config(c)
-#define apreq_env_content_type(c) APREQ_ENV.in(c, "Content-Type");
+#define apreq_env_content_type(c) APREQ_ENV.in(c, "Content-Type")
#define apreq_env_cookie(c) APREQ_ENV.in(c, "Cookie")
#define apreq_env_cookie2(c) APREQ_ENV.in(c, "Cookie2")
#define apreq_env_set_cookie(c,s) APREQ_ENV.out(c,"Set-Cookie",s)
====================================================================
allows the original form of apreq_parsers.c:
===============================================================
Index: apreq_parsers.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
retrieving revision 1.18
diff -u -r1.18 apreq_parsers.c
--- apreq_parsers.c 21 Apr 2003 16:09:09 -0000 1.18
+++ apreq_parsers.c 23 Apr 2003 06:32:22 -0000
@@ -751,11 +751,10 @@
#define MFD_ERROR -1
if (parser->v.size == 0) {
- const char *bdry, *ct;
+ const char *bdry, *ct = apreq_env_content_type(req->env);
apr_size_t blen;
apr_status_t s;
- ct = apreq_env_content_type(req->env);
memcpy(ctx->bdry, CRLF "--", 4);
s = nextval(&ct, "boundary", &bdry, &blen);
==================================================================
to now compile fine - I guess it was the extraneous ';' at
the end of the #define for apreq_env_content_type() that was
confusing VC++.
--
best regards,
randy
Re: [apreq-2] order of declarations
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Wed, 23 Apr 2003, Stas Bekman wrote:
>
>
>>So it expands into:
>>
>>const char *bdry, *ct = APREQ_ENV.in(req->env, "Content-Type");
>>apr_size_t blen;
>>
>>Does it still complain if you replace the macro?
>
>
> You're good at this :) The above does compile fine ...
What gives? VC++ C-preprocessor is borked?
>>May be it's because APREQ_ENV.in is a callback?:
>>
>> const char *(*in)(void *ctx, const char *name);
>>
>>Finally does this work?
>>
>>const char *bdry;
>>const char *ct = apreq_env_content_type(req->env);
>>apr_size_t blen;
>
>
> No, that gives the same error as before:
> syntax error : missing ';' before 'type'
> referring to the apr_size_t blen line, and then,
> referring to the next line,
> 'apr_status_t' : illegal use of this type as an expression
Meaning that its C-preprocessor has problems with substituting macros in the
declaration sections. That feels like it does the substitution in two path,
first doing the declarations and then the rest of the code.
What happens if you do this:
#define foo(c) APREQ_ENV.in(c, "Content-Type")
if (parser->v.size == 0) {
const char *bdry, *ct = foo(req->env);
apr_size_t blen;
anything related to the case of macro? This?
#define FOO(c) APREQ_ENV.in(c, "Content-Type")
if (parser->v.size == 0) {
const char *bdry, *ct = FOO(req->env);
apr_size_t blen;
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [apreq-2] order of declarations
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 23 Apr 2003, Stas Bekman wrote:
> So it expands into:
>
> const char *bdry, *ct = APREQ_ENV.in(req->env, "Content-Type");
> apr_size_t blen;
>
> Does it still complain if you replace the macro?
You're good at this :) The above does compile fine ...
>
> May be it's because APREQ_ENV.in is a callback?:
>
> const char *(*in)(void *ctx, const char *name);
>
> Finally does this work?
>
> const char *bdry;
> const char *ct = apreq_env_content_type(req->env);
> apr_size_t blen;
No, that gives the same error as before:
syntax error : missing ';' before 'type'
referring to the apr_size_t blen line, and then,
referring to the next line,
'apr_status_t' : illegal use of this type as an expression
--
best regards,
randy
Re: [apreq-2] order of declarations
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Mon, 21 Apr 2003, Stas Bekman wrote:
>
>
>>Randy Kobes wrote:
>>
>>>For apreq-2, VC++ on Win32 (but I think also some other
>>>compilers) is picky about the order of declaring
>>>variables in relation to assignments. This diff:
>>>================================================================
>>>Index: apreq_parsers.c
>>>===================================================================
>>>RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
>>>retrieving revision 1.15
>>>diff -u -r1.15 apreq_parsers.c
>>>--- apreq_parsers.c 18 Apr 2003 20:15:50 -0000 1.15
>>>+++ apreq_parsers.c 19 Apr 2003 19:25:16 -0000
>>>@@ -751,10 +751,11 @@
>>> #define MFD_ERROR -1
>>>
>>> if (parser->v.size == 0) {
>>>- const char *bdry, *ct = apreq_env_content_type(req->env);
>>>+ const char *bdry, *ct;
>>> apr_size_t blen;
>>> apr_status_t s;
>>>
>>>+ ct = apreq_env_content_type(req->env);
>>> memcpy(ctx->bdry, CRLF "--", 4);
>>>
>>> s = nextval(&ct, "boundary", &bdry, &blen);
>>>==================================================================
>>>is needed to compile apreq_parsers.c.
>>
>>Hmm, that's an unusual one. There are no declarations and standalone code
>>mixes here.
>>
>>This, is indeed invalid:
>>
>>int foo;
>>foo = 1;
>>int bar;
>>
>>However this is absolutely valid:
>>
>>int foo = 1;
>>int bar;
>>
>>So does this:
>>
>>int tar, foo = 1;
>>int bar;
>>
>>Is there something special about the last one?
>
>
> Welcome to VC++ :) There is something special about
> const char *bdry, *ct = apreq_env_content_type(req->env);
> apr_size_t blen;
> vs
> const char *bdry, *ct;
> apr_size_t blen;
> ct = apreq_env_content_type(req->env);
> on VC++ - the 1st one complains about a missing ';', and then
> gets confused that apr_size_t isn't being used as a declaration.
> I'll look into this further, but I think it has something to
> do with the way apreq_env_content_type() is defined - something
> like
> float x, y=sin(z);
> int t;
> is fine.
So it expands into:
const char *bdry, *ct = APREQ_ENV.in(req->env, "Content-Type");
apr_size_t blen;
Does it still complain if you replace the macro?
May be it's because APREQ_ENV.in is a callback?:
const char *(*in)(void *ctx, const char *name);
Finally does this work?
const char *bdry;
const char *ct = apreq_env_content_type(req->env);
apr_size_t blen;
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: [apreq-2] order of declarations
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 21 Apr 2003, Stas Bekman wrote:
> Randy Kobes wrote:
> > For apreq-2, VC++ on Win32 (but I think also some other
> > compilers) is picky about the order of declaring
> > variables in relation to assignments. This diff:
> > ================================================================
> > Index: apreq_parsers.c
> > ===================================================================
> > RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
> > retrieving revision 1.15
> > diff -u -r1.15 apreq_parsers.c
> > --- apreq_parsers.c 18 Apr 2003 20:15:50 -0000 1.15
> > +++ apreq_parsers.c 19 Apr 2003 19:25:16 -0000
> > @@ -751,10 +751,11 @@
> > #define MFD_ERROR -1
> >
> > if (parser->v.size == 0) {
> > - const char *bdry, *ct = apreq_env_content_type(req->env);
> > + const char *bdry, *ct;
> > apr_size_t blen;
> > apr_status_t s;
> >
> > + ct = apreq_env_content_type(req->env);
> > memcpy(ctx->bdry, CRLF "--", 4);
> >
> > s = nextval(&ct, "boundary", &bdry, &blen);
> > ==================================================================
> > is needed to compile apreq_parsers.c.
>
> Hmm, that's an unusual one. There are no declarations and standalone code
> mixes here.
>
> This, is indeed invalid:
>
> int foo;
> foo = 1;
> int bar;
>
> However this is absolutely valid:
>
> int foo = 1;
> int bar;
>
> So does this:
>
> int tar, foo = 1;
> int bar;
>
> Is there something special about the last one?
Welcome to VC++ :) There is something special about
const char *bdry, *ct = apreq_env_content_type(req->env);
apr_size_t blen;
vs
const char *bdry, *ct;
apr_size_t blen;
ct = apreq_env_content_type(req->env);
on VC++ - the 1st one complains about a missing ';', and then
gets confused that apr_size_t isn't being used as a declaration.
I'll look into this further, but I think it has something to
do with the way apreq_env_content_type() is defined - something
like
float x, y=sin(z);
int t;
is fine.
--
best regards,
randy
Re: [apreq-2] order of declarations
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> For apreq-2, VC++ on Win32 (but I think also some other
> compilers) is picky about the order of declaring
> variables in relation to assignments. This diff:
> ================================================================
> Index: apreq_parsers.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
> retrieving revision 1.15
> diff -u -r1.15 apreq_parsers.c
> --- apreq_parsers.c 18 Apr 2003 20:15:50 -0000 1.15
> +++ apreq_parsers.c 19 Apr 2003 19:25:16 -0000
> @@ -751,10 +751,11 @@
> #define MFD_ERROR -1
>
> if (parser->v.size == 0) {
> - const char *bdry, *ct = apreq_env_content_type(req->env);
> + const char *bdry, *ct;
> apr_size_t blen;
> apr_status_t s;
>
> + ct = apreq_env_content_type(req->env);
> memcpy(ctx->bdry, CRLF "--", 4);
>
> s = nextval(&ct, "boundary", &bdry, &blen);
> ==================================================================
> is needed to compile apreq_parsers.c.
Hmm, that's an unusual one. There are no declarations and standalone code
mixes here.
This, is indeed invalid:
int foo;
foo = 1;
int bar;
However this is absolutely valid:
int foo = 1;
int bar;
So does this:
int tar, foo = 1;
int bar;
Is there something special about the last one?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
[apreq-2] order of declarations
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
For apreq-2, VC++ on Win32 (but I think also some other
compilers) is picky about the order of declaring
variables in relation to assignments. This diff:
================================================================
Index: apreq_parsers.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_parsers.c,v
retrieving revision 1.15
diff -u -r1.15 apreq_parsers.c
--- apreq_parsers.c 18 Apr 2003 20:15:50 -0000 1.15
+++ apreq_parsers.c 19 Apr 2003 19:25:16 -0000
@@ -751,10 +751,11 @@
#define MFD_ERROR -1
if (parser->v.size == 0) {
- const char *bdry, *ct = apreq_env_content_type(req->env);
+ const char *bdry, *ct;
apr_size_t blen;
apr_status_t s;
+ ct = apreq_env_content_type(req->env);
memcpy(ctx->bdry, CRLF "--", 4);
s = nextval(&ct, "boundary", &bdry, &blen);
==================================================================
is needed to compile apreq_parsers.c.
--
best regards,
randy kobes