Fix compiler warning about dereferencing type-punned pointers
This is a backport of commit 19b9bff888
from the master branch.
This commit is contained in:
parent
b37135524d
commit
fe9444d585
31
src/conf.c
31
src/conf.c
@ -617,8 +617,8 @@ set_bool_arg (unsigned int *var, const char *line, regmatch_t * match)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long int
|
static unsigned long
|
||||||
get_int_arg (const char *line, regmatch_t * match)
|
get_long_arg (const char *line, regmatch_t * match)
|
||||||
{
|
{
|
||||||
assert (line);
|
assert (line);
|
||||||
assert (match && match->rm_so != -1);
|
assert (match && match->rm_so != -1);
|
||||||
@ -627,13 +627,13 @@ get_int_arg (const char *line, regmatch_t * match)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
set_int_arg (unsigned long int *var, const char *line, regmatch_t * match)
|
set_int_arg (unsigned int *var, const char *line, regmatch_t * match)
|
||||||
{
|
{
|
||||||
assert (var);
|
assert (var);
|
||||||
assert (line);
|
assert (line);
|
||||||
assert (match);
|
assert (match);
|
||||||
|
|
||||||
*var = get_int_arg (line, match);
|
*var = (unsigned int) get_long_arg (line, match);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,49 +755,50 @@ static HANDLE_FUNC (handle_bindsame)
|
|||||||
|
|
||||||
static HANDLE_FUNC (handle_port)
|
static HANDLE_FUNC (handle_port)
|
||||||
{
|
{
|
||||||
return set_int_arg ((unsigned long int *) &conf->port, line, &match[2]);
|
return set_int_arg (&conf->port, line, &match[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_maxclients)
|
static HANDLE_FUNC (handle_maxclients)
|
||||||
{
|
{
|
||||||
child_configure (CHILD_MAXCLIENTS, get_int_arg (line, &match[2]));
|
child_configure (CHILD_MAXCLIENTS, get_long_arg (line, &match[2]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_maxspareservers)
|
static HANDLE_FUNC (handle_maxspareservers)
|
||||||
{
|
{
|
||||||
child_configure (CHILD_MAXSPARESERVERS, get_int_arg (line, &match[2]));
|
child_configure (CHILD_MAXSPARESERVERS,
|
||||||
|
get_long_arg (line, &match[2]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_minspareservers)
|
static HANDLE_FUNC (handle_minspareservers)
|
||||||
{
|
{
|
||||||
child_configure (CHILD_MINSPARESERVERS, get_int_arg (line, &match[2]));
|
child_configure (CHILD_MINSPARESERVERS,
|
||||||
|
get_long_arg (line, &match[2]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_startservers)
|
static HANDLE_FUNC (handle_startservers)
|
||||||
{
|
{
|
||||||
child_configure (CHILD_STARTSERVERS, get_int_arg (line, &match[2]));
|
child_configure (CHILD_STARTSERVERS, get_long_arg (line, &match[2]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_maxrequestsperchild)
|
static HANDLE_FUNC (handle_maxrequestsperchild)
|
||||||
{
|
{
|
||||||
child_configure (CHILD_MAXREQUESTSPERCHILD,
|
child_configure (CHILD_MAXREQUESTSPERCHILD,
|
||||||
get_int_arg (line, &match[2]));
|
get_long_arg (line, &match[2]));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_timeout)
|
static HANDLE_FUNC (handle_timeout)
|
||||||
{
|
{
|
||||||
return set_int_arg ((unsigned long int *) &conf->idletimeout, line,
|
return set_int_arg (&conf->idletimeout, line, &match[2]);
|
||||||
&match[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_FUNC (handle_connectport)
|
static HANDLE_FUNC (handle_connectport)
|
||||||
{
|
{
|
||||||
add_connect_port_allowed (get_int_arg (line, &match[2]),
|
add_connect_port_allowed (get_long_arg (line, &match[2]),
|
||||||
&conf->connect_ports);
|
&conf->connect_ports);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -866,7 +867,7 @@ static HANDLE_FUNC (handle_errorfile)
|
|||||||
* present. This is why the "string" is located at
|
* present. This is why the "string" is located at
|
||||||
* match[4] (rather than the more intuitive match[3].
|
* match[4] (rather than the more intuitive match[3].
|
||||||
*/
|
*/
|
||||||
unsigned long int err = get_int_arg (line, &match[2]);
|
unsigned long int err = get_long_arg (line, &match[2]);
|
||||||
char *page = get_string_arg (line, &match[4]);
|
char *page = get_string_arg (line, &match[4]);
|
||||||
|
|
||||||
add_new_errorpage (page, err);
|
add_new_errorpage (page, err);
|
||||||
@ -1019,7 +1020,7 @@ static HANDLE_FUNC (handle_upstream)
|
|||||||
ip = get_string_arg (line, &match[2]);
|
ip = get_string_arg (line, &match[2]);
|
||||||
if (!ip)
|
if (!ip)
|
||||||
return -1;
|
return -1;
|
||||||
port = (int) get_int_arg (line, &match[7]);
|
port = (int) get_long_arg (line, &match[7]);
|
||||||
|
|
||||||
if (match[9].rm_so != -1) {
|
if (match[9].rm_so != -1) {
|
||||||
domain = get_string_arg (line, &match[9]);
|
domain = get_string_arg (line, &match[9]);
|
||||||
|
@ -40,7 +40,7 @@ struct config_s {
|
|||||||
char *logf_name;
|
char *logf_name;
|
||||||
char *config_file;
|
char *config_file;
|
||||||
unsigned int syslog; /* boolean */
|
unsigned int syslog; /* boolean */
|
||||||
int port;
|
unsigned int port;
|
||||||
char *stathost;
|
char *stathost;
|
||||||
unsigned int godaemon; /* boolean */
|
unsigned int godaemon; /* boolean */
|
||||||
unsigned int quit; /* boolean */
|
unsigned int quit; /* boolean */
|
||||||
|
Loading…
Reference in New Issue
Block a user