-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.143 2015/08/12 10:38:02 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.146 2016/02/26 12:29:38 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
* routine to load the configuration and the global
* variables it writes to.
*
- * Copyright : Written by and Copyright (C) 2001-2014 the
+ * Copyright : Written by and Copyright (C) 2001-2016 the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
global_toggle_state = 1;
#endif /* def FEATURE_TOGGLE */
- fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
-
- if (NULL == config)
- {
- freez(fs->filename);
- freez(fs);
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- return NULL;
- }
+ fs->f = config = zalloc_or_die(sizeof(*config));
/*
* This is backwards from how it's usually done.
int compression_level = parse_numeric_value(cmd, arg);
if (-1 <= compression_level && compression_level <= 9)
{
- config->compression_level = compression_level;;
+ config->compression_level = compression_level;
}
else
{
}
/* allocate a new node */
- cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
-
- if (cur_acl == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- /* Never get here - LOG_LEVEL_FATAL causes program exit */
- break;
- }
+ cur_acl = zalloc_or_die(sizeof(*cur_acl));
cur_acl->action = ACL_DENY;
if (acl_addr(vec[0], cur_acl->src) < 0)
}
/* allocate a new node */
- cur_fwd = zalloc(sizeof(*cur_fwd));
- if (cur_fwd == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- /* Never get here - LOG_LEVEL_FATAL causes program exit */
- break;
- }
-
+ cur_fwd = zalloc_or_die(sizeof(*cur_fwd));
cur_fwd->type = SOCKS_NONE;
/* Save the URL pattern */
}
/* allocate a new node */
- cur_fwd = zalloc(sizeof(*cur_fwd));
- if (cur_fwd == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- /* Never get here - LOG_LEVEL_FATAL causes program exit */
- break;
- }
-
+ cur_fwd = zalloc_or_die(sizeof(*cur_fwd));
cur_fwd->type = SOCKS_4;
/* Save the URL pattern */
}
/* allocate a new node */
- cur_fwd = zalloc(sizeof(*cur_fwd));
- if (cur_fwd == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- /* Never get here - LOG_LEVEL_FATAL causes program exit */
- break;
- }
+ cur_fwd = zalloc_or_die(sizeof(*cur_fwd));
if (directive_hash == hash_forward_socks4a)
{
}
/* allocate a new node */
- cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
-
- if (cur_acl == NULL)
- {
- log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
- /* Never get here - LOG_LEVEL_FATAL causes program exit */
- break;
- }
+ cur_acl = zalloc_or_die(sizeof(*cur_acl));
cur_acl->action = ACL_PERMIT;
if (acl_addr(vec[0], cur_acl->src) < 0)
*
* Need to set up a fake csp, so they can get to the config.
*/
- fake_csp = (struct client_state *) zalloc (sizeof(*fake_csp));
+ fake_csp = zalloc_or_die(sizeof(*fake_csp));
fake_csp->config = config;
if (run_loader(fake_csp))