config.c (1709ccf9d38a5753192420ce5fccd93b04ce4d07) | config.c (b04a7a0baf6523245034b8ccd06cd0176b8a18cf) |
---|---|
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: --- 503 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 | 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: --- 503 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 --- |