mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Improvements found by cppcheck:
remove some unused variables and dead assignments, reduce the scope of some variables, add some parens to improve readability git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1103459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1260,10 +1260,8 @@ static void note_digest_auth_failure(request_rec *r,
|
|||||||
digest_header_rec *resp, int stale)
|
digest_header_rec *resp, int stale)
|
||||||
{
|
{
|
||||||
const char *qop, *opaque, *opaque_param, *domain, *nonce;
|
const char *qop, *opaque, *opaque_param, *domain, *nonce;
|
||||||
int cnt;
|
|
||||||
|
|
||||||
/* Setup qop */
|
/* Setup qop */
|
||||||
|
|
||||||
if (conf->qop_list[0] == NULL) {
|
if (conf->qop_list[0] == NULL) {
|
||||||
qop = ", qop=\"auth\"";
|
qop = ", qop=\"auth\"";
|
||||||
}
|
}
|
||||||
@@ -1271,6 +1269,7 @@ static void note_digest_auth_failure(request_rec *r,
|
|||||||
qop = "";
|
qop = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int cnt;
|
||||||
qop = apr_pstrcat(r->pool, ", qop=\"", conf->qop_list[0], NULL);
|
qop = apr_pstrcat(r->pool, ", qop=\"", conf->qop_list[0], NULL);
|
||||||
for (cnt = 1; conf->qop_list[cnt] != NULL; cnt++) {
|
for (cnt = 1; conf->qop_list[cnt] != NULL; cnt++) {
|
||||||
qop = apr_pstrcat(r->pool, qop, ",", conf->qop_list[cnt], NULL);
|
qop = apr_pstrcat(r->pool, qop, ",", conf->qop_list[cnt], NULL);
|
||||||
|
4
modules/cache/mod_socache_shmcb.c
vendored
4
modules/cache/mod_socache_shmcb.c
vendored
@@ -561,7 +561,7 @@ static void socache_shmcb_status(ap_socache_instance_t *ctx,
|
|||||||
server_rec *s = r->server;
|
server_rec *s = r->server;
|
||||||
SHMCBHeader *header = ctx->header;
|
SHMCBHeader *header = ctx->header;
|
||||||
unsigned int loop, total = 0, cache_total = 0, non_empty_subcaches = 0;
|
unsigned int loop, total = 0, cache_total = 0, non_empty_subcaches = 0;
|
||||||
apr_time_t idx_expiry, min_expiry = 0, max_expiry = 0, average_expiry = 0;
|
apr_time_t idx_expiry, min_expiry = 0, max_expiry = 0;
|
||||||
apr_time_t now = apr_time_now();
|
apr_time_t now = apr_time_now();
|
||||||
double expiry_total = 0;
|
double expiry_total = 0;
|
||||||
int index_pct, cache_pct;
|
int index_pct, cache_pct;
|
||||||
@@ -599,7 +599,7 @@ static void socache_shmcb_status(ap_socache_instance_t *ctx,
|
|||||||
ap_rprintf(r, "subcaches: <b>%d</b>, indexes per subcache: <b>%d</b><br>",
|
ap_rprintf(r, "subcaches: <b>%d</b>, indexes per subcache: <b>%d</b><br>",
|
||||||
header->subcache_num, header->index_num);
|
header->subcache_num, header->index_num);
|
||||||
if (non_empty_subcaches) {
|
if (non_empty_subcaches) {
|
||||||
average_expiry = (apr_time_t)(expiry_total / (double)non_empty_subcaches);
|
apr_time_t average_expiry = (apr_time_t)(expiry_total / (double)non_empty_subcaches);
|
||||||
ap_rprintf(r, "time left on oldest entries' objects: ");
|
ap_rprintf(r, "time left on oldest entries' objects: ");
|
||||||
if (now < average_expiry)
|
if (now < average_expiry)
|
||||||
ap_rprintf(r, "avg: <b>%d</b> seconds, (range: %d...%d)<br>",
|
ap_rprintf(r, "avg: <b>%d</b> seconds, (range: %d...%d)<br>",
|
||||||
|
@@ -2342,7 +2342,7 @@ static int dav_method_proppatch(request_rec *r)
|
|||||||
|
|
||||||
/* Ignore children that are not set/remove */
|
/* Ignore children that are not set/remove */
|
||||||
if (child->ns != APR_XML_NS_DAV_ID
|
if (child->ns != APR_XML_NS_DAV_ID
|
||||||
|| (!(is_remove = strcmp(child->name, "remove") == 0)
|
|| (!(is_remove = (strcmp(child->name, "remove") == 0))
|
||||||
&& strcmp(child->name, "set") != 0)) {
|
&& strcmp(child->name, "set") != 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -69,14 +69,13 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
|||||||
#endif
|
#endif
|
||||||
const char *buf;
|
const char *buf;
|
||||||
apr_size_t nbytes;
|
apr_size_t nbytes;
|
||||||
apr_size_t logbytes;
|
|
||||||
apr_status_t rv = apr_bucket_read(b, &buf, &nbytes, APR_BLOCK_READ);
|
apr_status_t rv = apr_bucket_read(b, &buf, &nbytes, APR_BLOCK_READ);
|
||||||
|
|
||||||
if (rv == APR_SUCCESS)
|
if (rv == APR_SUCCESS)
|
||||||
{
|
{
|
||||||
while (nbytes)
|
while (nbytes)
|
||||||
{
|
{
|
||||||
logbytes = nbytes;
|
apr_size_t logbytes = nbytes;
|
||||||
if (logbytes > dumpio_MAX_STRING_LEN)
|
if (logbytes > dumpio_MAX_STRING_LEN)
|
||||||
logbytes = dumpio_MAX_STRING_LEN;
|
logbytes = dumpio_MAX_STRING_LEN;
|
||||||
nbytes -= logbytes;
|
nbytes -= logbytes;
|
||||||
|
@@ -135,11 +135,11 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter)
|
|||||||
ap_filter_provider_t *provider;
|
ap_filter_provider_t *provider;
|
||||||
int match;
|
int match;
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
unsigned int proto_flags;
|
|
||||||
request_rec *r = f->r;
|
request_rec *r = f->r;
|
||||||
harness_ctx *ctx = f->ctx;
|
harness_ctx *ctx = f->ctx;
|
||||||
provider_ctx *pctx;
|
provider_ctx *pctx;
|
||||||
#ifndef NO_PROTOCOL
|
#ifndef NO_PROTOCOL
|
||||||
|
unsigned int proto_flags;
|
||||||
mod_filter_ctx *rctx = ap_get_module_config(r->request_config,
|
mod_filter_ctx *rctx = ap_get_module_config(r->request_config,
|
||||||
&filter_module);
|
&filter_module);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1333,7 +1333,7 @@ static char *lookup_map_dbd(request_rec *r, char *key, const char *label)
|
|||||||
"rewritemap: error %s querying for %s", errmsg, key);
|
"rewritemap: error %s querying for %s", errmsg, key);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
while (rv = apr_dbd_get_row(db->driver, r->pool, res, &row, -1), rv == 0) {
|
while ((rv = apr_dbd_get_row(db->driver, r->pool, res, &row, -1)) == 0) {
|
||||||
++n;
|
++n;
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
ret = apr_dbd_get_entry(db->driver, row, 0);
|
ret = apr_dbd_get_entry(db->driver, row, 0);
|
||||||
|
@@ -509,7 +509,6 @@ static int ssl_rand_choosenum(int l, int h)
|
|||||||
|
|
||||||
static void ssl_rand_seed(void)
|
static void ssl_rand_seed(void)
|
||||||
{
|
{
|
||||||
int nDone = 0;
|
|
||||||
int n, l;
|
int n, l;
|
||||||
time_t t;
|
time_t t;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
@@ -521,7 +520,6 @@ static void ssl_rand_seed(void)
|
|||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
l = sizeof(time_t);
|
l = sizeof(time_t);
|
||||||
RAND_seed((unsigned char *)&t, l);
|
RAND_seed((unsigned char *)&t, l);
|
||||||
nDone += l;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* seed in the current process id (usually just 4 bytes)
|
* seed in the current process id (usually just 4 bytes)
|
||||||
@@ -529,14 +527,12 @@ static void ssl_rand_seed(void)
|
|||||||
pid = getpid();
|
pid = getpid();
|
||||||
l = sizeof(pid_t);
|
l = sizeof(pid_t);
|
||||||
RAND_seed((unsigned char *)&pid, l);
|
RAND_seed((unsigned char *)&pid, l);
|
||||||
nDone += l;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* seed in some current state of the run-time stack (128 bytes)
|
* seed in some current state of the run-time stack (128 bytes)
|
||||||
*/
|
*/
|
||||||
n = ssl_rand_choosenum(0, sizeof(stackdata)-128-1);
|
n = ssl_rand_choosenum(0, sizeof(stackdata)-128-1);
|
||||||
RAND_seed(stackdata+n, 128);
|
RAND_seed(stackdata+n, 128);
|
||||||
nDone += 128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_print_connection_info(BIO *bio, SSL *ssl)
|
static int ssl_print_connection_info(BIO *bio, SSL *ssl)
|
||||||
|
@@ -239,7 +239,6 @@ int main(int argc, char *argv[])
|
|||||||
char *target_homedir; /* target home directory */
|
char *target_homedir; /* target home directory */
|
||||||
char *actual_uname; /* actual user name */
|
char *actual_uname; /* actual user name */
|
||||||
char *actual_gname; /* actual group name */
|
char *actual_gname; /* actual group name */
|
||||||
char *prog; /* name of this program */
|
|
||||||
char *cmd; /* command to be executed */
|
char *cmd; /* command to be executed */
|
||||||
char cwd[AP_MAXPATH]; /* current working directory */
|
char cwd[AP_MAXPATH]; /* current working directory */
|
||||||
char dwd[AP_MAXPATH]; /* docroot working directory */
|
char dwd[AP_MAXPATH]; /* docroot working directory */
|
||||||
@@ -253,7 +252,6 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
clean_env();
|
clean_env();
|
||||||
|
|
||||||
prog = argv[0];
|
|
||||||
/*
|
/*
|
||||||
* Check existence/validity of the UID of the user
|
* Check existence/validity of the UID of the user
|
||||||
* running this program. Error out if invalid.
|
* running this program. Error out if invalid.
|
||||||
|
@@ -1299,7 +1299,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
|
|||||||
|
|
||||||
case WM_TIMER_REFRESH:
|
case WM_TIMER_REFRESH:
|
||||||
{
|
{
|
||||||
int nPrev = 0, nNew = 0;
|
|
||||||
EnterCriticalSection(&g_stcSection);
|
EnterCriticalSection(&g_stcSection);
|
||||||
if (g_bRescanServices)
|
if (g_bRescanServices)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user