* server/protocol.c (r_flush): Use int return type as per declaration
of apr_vformatter(); no functional change.
Use %pm in order to save 8k of stack in 'ap_pcfg_strerror'
s/apr_pstrndup/apr_pstrmemdup/ when applicable
follow-up to r1096569:
remove unnecessary total_modules calculation
Submitted by: jorton, jailletc36, jailletc36, trawick
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@
1569726 13f79535-47bb-0310-9956-
ffa450edef68
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * Easy proposals to synch 2.4 and trunk
- - server/protocol.c (r_flush): Use int return type as per declaration
- of apr_vformatter(); no functional change.
- - core: Use %pm in order to save 8k of stack in 'ap_pcfg_strerror'
- - core & cache: s/apr_pstrndup/apr_pstrmemdup/ when applicable
- - mod_cgid: remove unnecessary total_modules calculation (follow-up to r1096569)
- trunk patch: http://svn.apache.org/r1487528
- http://svn.apache.org/r1563379
- http://svn.apache.org/r1563381
- http://svn.apache.org/r1565711
- 2.4.x patch: trunk patches work
- +1: jailletc36, covener, jim
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
&& !strncmp(param + 1, *identifier, len)
&& (*(param + len + 1) == '=')
&& !ap_strchr_c(param + len + 2, '/')) {
- path = apr_pstrndup(p, path, param - path);
+ path = apr_pstrmemdup(p, path, param - path);
continue;
}
/*
static APR_OPTIONAL_FN_TYPE(ap_ssi_parse_string) *cgid_pfn_ps;
static apr_pool_t *pcgi = NULL;
-static int total_modules = 0;
static pid_t daemon_pid;
static int daemon_should_exit = 0;
static server_rec *root_server = NULL;
{
apr_proc_t *procnew = NULL;
const char *userdata_key = "cgid_init";
- module **m;
int ret = OK;
void *data;
if (ap_state_query(AP_SQ_MAIN_STATE) != AP_SQ_MS_CREATE_PRE_CONFIG) {
char *tmp_sockname;
- total_modules = 0;
- for (m = ap_preloaded_modules; *m != NULL; m++)
- total_modules++;
parent_pid = getpid();
tmp_sockname = ap_runtime_dir_relative(p, sockname);
char *buff;
};
-static apr_status_t r_flush(apr_vformatter_buff_t *buff)
+/* Flush callback for apr_vformatter; returns -1 on error. */
+static int r_flush(apr_vformatter_buff_t *buff)
{
/* callback function passed to ap_vformatter to be called when
* vformatter needs to write into buff and buff.curpos > buff.endpos */
vd->vbuff.curpos = vd->buff;
vd->vbuff.endpos = vd->buff + AP_IOBUFSIZE;
- return APR_SUCCESS;
+ return 0;
}
AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list va)
while ((semi > intype) && apr_isspace(semi[-1])) {
semi--;
}
- return apr_pstrndup(p, intype, semi - intype);
+ return apr_pstrmemdup(p, intype, semi - intype);
}
}
return res;
}
- res = apr_pstrndup(atrans, *line, pos - *line);
+ res = apr_pstrmemdup(atrans, *line, pos - *line);
++pos;
AP_DECLARE(const char *) ap_pcfg_strerror(apr_pool_t *p, ap_configfile_t *cfp,
apr_status_t rc)
{
- char buf[MAX_STRING_LEN];
if (rc == APR_SUCCESS)
return NULL;
- return apr_psprintf(p, "Error reading %s at line %d: %s",
- cfp->name, cfp->line_number,
- rc == APR_ENOSPC ? "Line too long"
- : apr_strerror(rc, buf, sizeof(buf)));
+
+ if (rc == APR_ENOSPC)
+ return apr_psprintf(p, "Error reading %s at line %d: Line too long",
+ cfp->name, cfp->line_number);
+
+ return apr_psprintf(p, "Error reading %s at line %d: %pm",
+ cfp->name, cfp->line_number, &rc);
}
/* Read one line from open ap_configfile_t, strip LF, increase line number */
const char *ptr = *accept_line;
const char *tok_start;
char *token;
- int tok_len;
/* Find first non-white byte */
break;
}
- tok_len = ptr - tok_start;
- token = apr_pstrndup(p, tok_start, tok_len);
+ token = apr_pstrmemdup(p, tok_start, ptr - tok_start);
/* Advance accept_line pointer to the next non-white byte */