Deleted Added
full compact
config.c (263624) config.c (268896)
1/*-
2 * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
3 * Copyright (c) 2013 Bryan Drewery <bdrewery@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
3 * Copyright (c) 2013 Bryan Drewery <bdrewery@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: stable/10/usr.sbin/pkg/config.c 263624 2014-03-22 10:47:49Z bdrewery $");
29__FBSDID("$FreeBSD: stable/10/usr.sbin/pkg/config.c 268896 2014-07-19 23:44:57Z bapt $");
30
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/sbuf.h>
34#include <sys/elf_common.h>
35#include <sys/endian.h>
36#include <sys/types.h>
37

--- 474 unchanged lines hidden (view full) ---

512 strcasecmp(str, "yes") == 0 || strcasecmp(str, "on") == 0 ||
513 str[0] == '1'))
514 return (true);
515
516 return (false);
517}
518
519static void
30
31#include <sys/param.h>
32#include <sys/queue.h>
33#include <sys/sbuf.h>
34#include <sys/elf_common.h>
35#include <sys/endian.h>
36#include <sys/types.h>
37

--- 474 unchanged lines hidden (view full) ---

512 strcasecmp(str, "yes") == 0 || strcasecmp(str, "on") == 0 ||
513 str[0] == '1'))
514 return (true);
515
516 return (false);
517}
518
519static void
520config_parse(ucl_object_t *obj, pkg_conf_file_t conftype)
520config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype)
521{
522 struct sbuf *buf = sbuf_new_auto();
521{
522 struct sbuf *buf = sbuf_new_auto();
523 ucl_object_t *cur, *seq;
523 const ucl_object_t *cur, *seq;
524 ucl_object_iter_t it = NULL, itseq = NULL;
525 struct config_entry *temp_config;
526 struct config_value *cv;
527 const char *key;
528 int i;
529 size_t j;
530
531 /* Temporary config for configs that may be disabled. */

--- 101 unchanged lines hidden (view full) ---

633 * URL:
634 * MIRROR_TYPE:
635 * etc...
636 */
637static void
638parse_repo_file(ucl_object_t *obj)
639{
640 ucl_object_iter_t it = NULL;
524 ucl_object_iter_t it = NULL, itseq = NULL;
525 struct config_entry *temp_config;
526 struct config_value *cv;
527 const char *key;
528 int i;
529 size_t j;
530
531 /* Temporary config for configs that may be disabled. */

--- 101 unchanged lines hidden (view full) ---

633 * URL:
634 * MIRROR_TYPE:
635 * etc...
636 */
637static void
638parse_repo_file(ucl_object_t *obj)
639{
640 ucl_object_iter_t it = NULL;
641 ucl_object_t *cur;
641 const ucl_object_t *cur;
642 const char *key;
643
644 while ((cur = ucl_iterate_object(obj, &it, true))) {
645 key = ucl_object_key(cur);
646
647 if (key == NULL)
648 continue;
649

--- 28 unchanged lines hidden (view full) ---

678 "configuration file %s", confpath);
679 else {
680 if (conftype == CONFFILE_PKG)
681 config_parse(obj, conftype);
682 else if (conftype == CONFFILE_REPO)
683 parse_repo_file(obj);
684 }
685
642 const char *key;
643
644 while ((cur = ucl_iterate_object(obj, &it, true))) {
645 key = ucl_object_key(cur);
646
647 if (key == NULL)
648 continue;
649

--- 28 unchanged lines hidden (view full) ---

678 "configuration file %s", confpath);
679 else {
680 if (conftype == CONFFILE_PKG)
681 config_parse(obj, conftype);
682 else if (conftype == CONFFILE_REPO)
683 parse_repo_file(obj);
684 }
685
686 ucl_object_free(obj);
686 ucl_object_unref(obj);
687 ucl_parser_free(p);
688
689 return (0);
690}
691
692static int
693load_repositories(const char *repodir)
694{

--- 155 unchanged lines hidden ---
687 ucl_parser_free(p);
688
689 return (0);
690}
691
692static int
693load_repositories(const char *repodir)
694{

--- 155 unchanged lines hidden ---