xbps_init: avoid using a global var.
This commit is contained in:
parent
b7da3464dd
commit
cfae783f64
@ -40,7 +40,6 @@
|
|||||||
* using libxbps and finalize usage to release resources at the end.
|
* using libxbps and finalize usage to release resources at the end.
|
||||||
*/
|
*/
|
||||||
static bool debug;
|
static bool debug;
|
||||||
static bool syslog_enabled;
|
|
||||||
static bool xbps_initialized;
|
static bool xbps_initialized;
|
||||||
static struct xbps_handle *xhp;
|
static struct xbps_handle *xhp;
|
||||||
|
|
||||||
@ -106,6 +105,7 @@ xbps_init(struct xbps_handle *xh)
|
|||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
int rv, cc, cch;
|
int rv, cc, cch;
|
||||||
|
bool syslog_enabled = false;
|
||||||
|
|
||||||
assert(xh != NULL);
|
assert(xh != NULL);
|
||||||
|
|
||||||
@ -169,8 +169,7 @@ xbps_init(struct xbps_handle *xh)
|
|||||||
cc = XBPS_FETCH_CACHECONN;
|
cc = XBPS_FETCH_CACHECONN;
|
||||||
cch = XBPS_FETCH_CACHECONN_HOST;
|
cch = XBPS_FETCH_CACHECONN_HOST;
|
||||||
} else {
|
} else {
|
||||||
syslog_enabled = cfg_getbool(xhp->cfg, "syslog");
|
if (cfg_getbool(xhp->cfg, "syslog"))
|
||||||
if (syslog_enabled)
|
|
||||||
xhp->flags |= XBPS_FLAG_SYSLOG;
|
xhp->flags |= XBPS_FLAG_SYSLOG;
|
||||||
xhp->fetch_timeout = cfg_getint(xhp->cfg, "FetchTimeoutConnection");
|
xhp->fetch_timeout = cfg_getint(xhp->cfg, "FetchTimeoutConnection");
|
||||||
cc = cfg_getint(xhp->cfg, "FetchCacheConnections");
|
cc = cfg_getint(xhp->cfg, "FetchCacheConnections");
|
||||||
@ -178,7 +177,7 @@ xbps_init(struct xbps_handle *xh)
|
|||||||
xhp->transaction_frequency_flush =
|
xhp->transaction_frequency_flush =
|
||||||
cfg_getint(xhp->cfg, "TransactionFrequencyFlush");
|
cfg_getint(xhp->cfg, "TransactionFrequencyFlush");
|
||||||
}
|
}
|
||||||
if (!syslog_enabled && (xhp->flags & XBPS_FLAG_SYSLOG))
|
if (xhp->flags & XBPS_FLAG_SYSLOG)
|
||||||
syslog_enabled = true;
|
syslog_enabled = true;
|
||||||
|
|
||||||
xbps_fetch_set_cache_connection(cc, cch);
|
xbps_fetch_set_cache_connection(cc, cch);
|
||||||
|
Loading…
Reference in New Issue
Block a user