We copy the data when we store it in the structures, we can just return
a pointer from there, and use const data. This puts the onus back on
Apache to copy the data if it needs to modify it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87592
13f79535-47bb-0310-9956-
ffa450edef68
Changes with Apache 2.0b1
+ *) Stop returning copies of filenames from both apr_file_t and
+ apr_dir_t. We pstrdup the filenames that we store in the
+ actual structures, so we don't need to pstrdup the strings again.
+ [Ryan Bloom]
+
*) mod_cgi: Fix some problems where the wrong error value was being
traced. [Jeff Trawick]
return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
}
while ((apr_readdir(dirp)) == APR_SUCCESS) {
- char *name;
+ const char *name;
apr_size_t len;
apr_get_dir_filename(&name, dirp);
return NULL;
}
-static struct ent *make_autoindex_entry(char *name, int autoindex_opts,
+static struct ent *make_autoindex_entry(const char *name, int autoindex_opts,
autoindex_config_rec *d,
request_rec *r, char keyid,
char direction)
*/
head = NULL;
while (apr_readdir(d) == APR_SUCCESS) {
- char *d_name;
+ const char *d_name;
apr_get_dir_filename(&d_name, d);
p = make_autoindex_entry(d_name, autoindex_opts,
autoindex_conf, r, keyid, direction);
while (apr_readdir(dirp) == APR_SUCCESS) {
request_rec *sub_req;
- char *d_name;
+ const char *d_name;
apr_get_dir_filename(&d_name, dirp);
/* Do we have a match? */
static int check_speling(request_rec *r)
{
spconfig *cfg;
- char *good, *bad, *postgood, *url, *fname;
+ char *good, *bad, *postgood, *url;
+ const char *fname;
int filoc, dotloc, urlen, pglen;
apr_array_header_t *candidates = NULL;
apr_dir_t *dir;
dotloc = strlen(bad);
}
- /* NOTE: apr_get_dir_filename() fills fname with a apr_palloc()ed copy
- * of the found directory name already. We don't need to copy it.
- * @@@: Copying *ALL* found file names is wasted energy (and memory)!
- */
while (apr_readdir(dir) == APR_SUCCESS &&
apr_get_dir_filename(&fname, dir) == APR_SUCCESS) {
sp_reason q;
misspelled_file *sp_new;
sp_new = (misspelled_file *) apr_push_array(candidates);
- sp_new->name = fname;
+ sp_new->name = apr_pstrdup(r->pool, fname);
sp_new->quality = SP_MISCAPITALIZED;
}
misspelled_file *sp_new;
sp_new = (misspelled_file *) apr_push_array(candidates);
- sp_new->name = fname;
+ sp_new->name = apr_pstrdup(r->pool, fname);
sp_new->quality = q;
}
misspelled_file *sp_new;
sp_new = (misspelled_file *) apr_push_array(candidates);
- sp_new->name = fname;
+ sp_new->name = apr_pstrdup(r->pool, fname);
sp_new->quality = SP_VERYDIFFERENT;
}
#endif
*/
head = NULL;
while (apr_readdir(d) == APR_SUCCESS) {
- char *d_name;
+ const char *d_name;
apr_get_dir_filename(&d_name, d);
p = make_autoindex_entry(d_name, autoindex_opts,
autoindex_conf, r, keyid, direction);
}
candidates = apr_make_array(p, 1, sizeof(fnames));
while (apr_readdir(dirp) == APR_SUCCESS) {
- char *d_name;
+ const char *d_name;
apr_get_dir_filename(&d_name, dirp);
/* strip out '.' and '..' */
if (strcmp(d_name, ".") &&