httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject the effectiveness of split_to_parms
Date Fri, 19 Apr 2002 08:12:05 GMT

in request.c

Any reason why do we call unescape and req_plustospace functions in a 
loop, instead of doing this once on *data? I think calling the function 
once on a long string is faster then calling the same function 20 times 
(if we have 10 fields) on shorter strings.

Also what's the use of calling req_plustospace on the key string?

static void split_to_parms(apreq_request_t *req, const char *data)
     request_rec *r = req->r;
     const char *val;

     while (*data && (val = my_urlword(r->pool, &data))) {
	const char *key = ap_getword(r->pool, &val, '=');


	apr_table_add(req->parms, key, val);


I'd write it as:

     while (*data && (val = my_urlword(r->pool, &data))) {
	apr_table_add(req->parms, ap_getword(r->pool, &val, '='), val);

I'm not sure if it's valid to modify 'val' in the second arg and expect 
its value to be modified in the third. I must use a tmp var, right?

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

View raw message