xbps-uhelper: optimize some targets where xbps_init() is not necessary.

This commit is contained in:
Juan RP 2011-11-05 08:41:29 +01:00
parent 7b251477e5
commit fe3353a2b2

View File

@ -110,11 +110,11 @@ usage(struct xbps_handle *xhp)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
struct xbps_handle *xhp; struct xbps_handle *xhp = NULL;
struct xferstat xfer; struct xferstat xfer;
prop_dictionary_t dict; prop_dictionary_t dict;
const char *version, *rootdir = NULL, *confdir = NULL; const char *version, *rootdir = NULL, *confdir = NULL;
char *plist, *pkgname, *pkgver, *in_chroot_env, *hash; char *plist = NULL, *pkgname, *pkgver, *in_chroot_env, *hash;
bool debug = false, in_chroot = false; bool debug = false, in_chroot = false;
int i, c, rv = 0; int i, c, rv = 0;
@ -145,6 +145,10 @@ main(int argc, char **argv)
if (argc < 1) if (argc < 1)
usage(NULL); usage(NULL);
if ((strcasecmp(argv[0], "register") == 0) ||
(strcasecmp(argv[0], "unregister") == 0) ||
(strcasecmp(argv[0], "version") == 0) ||
(strcasecmp(argv[0], "fetch") == 0)) {
/* /*
* Initialize the callbacks and debug in libxbps. * Initialize the callbacks and debug in libxbps.
*/ */
@ -173,6 +177,7 @@ main(int argc, char **argv)
xbps_end(xhp); xbps_end(xhp);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
}
in_chroot_env = getenv("in_chroot"); in_chroot_env = getenv("in_chroot");
if (in_chroot_env != NULL) if (in_chroot_env != NULL)