Deleted Added
full compact
ucl_util.c (302408) ucl_util.c (307790)
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * Copyright (c) 2015 Allan Jude <allanjude@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

1790 ucl_parser_register_variable (parser, "FILENAME", "undef");
1791 ucl_parser_register_variable (parser, "CURDIR", curdir);
1792 }
1793
1794 return true;
1795}
1796
1797bool
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * Copyright (c) 2015 Allan Jude <allanjude@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

1790 ucl_parser_register_variable (parser, "FILENAME", "undef");
1791 ucl_parser_register_variable (parser, "CURDIR", curdir);
1792 }
1793
1794 return true;
1795}
1796
1797bool
1798ucl_parser_add_file_priority (struct ucl_parser *parser, const char *filename,
1799 unsigned priority)
1798ucl_parser_add_file_full (struct ucl_parser *parser, const char *filename,
1799 unsigned priority, enum ucl_duplicate_strategy strat,
1800 enum ucl_parse_type parse_type)
1800{
1801 unsigned char *buf;
1802 size_t len;
1803 bool ret;
1804 char realbuf[PATH_MAX];
1805
1806 if (ucl_realpath (filename, realbuf) == NULL) {
1807 ucl_create_err (&parser->err, "cannot open file %s: %s",

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

1814 return false;
1815 }
1816
1817 if (parser->cur_file) {
1818 free (parser->cur_file);
1819 }
1820 parser->cur_file = strdup (realbuf);
1821 ucl_parser_set_filevars (parser, realbuf, false);
1801{
1802 unsigned char *buf;
1803 size_t len;
1804 bool ret;
1805 char realbuf[PATH_MAX];
1806
1807 if (ucl_realpath (filename, realbuf) == NULL) {
1808 ucl_create_err (&parser->err, "cannot open file %s: %s",

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

1815 return false;
1816 }
1817
1818 if (parser->cur_file) {
1819 free (parser->cur_file);
1820 }
1821 parser->cur_file = strdup (realbuf);
1822 ucl_parser_set_filevars (parser, realbuf, false);
1822 ret = ucl_parser_add_chunk_priority (parser, buf, len, priority);
1823 ret = ucl_parser_add_chunk_full (parser, buf, len, priority, strat,
1824 parse_type);
1823
1824 if (len > 0) {
1825 ucl_munmap (buf, len);
1826 }
1827
1828 return ret;
1829}
1830
1831bool
1825
1826 if (len > 0) {
1827 ucl_munmap (buf, len);
1828 }
1829
1830 return ret;
1831}
1832
1833bool
1834ucl_parser_add_file_priority (struct ucl_parser *parser, const char *filename,
1835 unsigned priority)
1836{
1837 if (parser == NULL) {
1838 return false;
1839 }
1840
1841 return ucl_parser_add_file_full(parser, filename, priority,
1842 UCL_DUPLICATE_APPEND, UCL_PARSE_UCL);
1843}
1844
1845bool
1832ucl_parser_add_file (struct ucl_parser *parser, const char *filename)
1833{
1834 if (parser == NULL) {
1835 return false;
1836 }
1837
1846ucl_parser_add_file (struct ucl_parser *parser, const char *filename)
1847{
1848 if (parser == NULL) {
1849 return false;
1850 }
1851
1838 return ucl_parser_add_file_priority(parser, filename,
1839 parser->default_priority);
1852 return ucl_parser_add_file_full(parser, filename,
1853 parser->default_priority, UCL_DUPLICATE_APPEND,
1854 UCL_PARSE_UCL);
1840}
1841
1842bool
1843ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
1844 unsigned priority)
1845{
1846 unsigned char *buf;
1847 size_t len;

--- 1648 unchanged lines hidden ---
1855}
1856
1857bool
1858ucl_parser_add_fd_priority (struct ucl_parser *parser, int fd,
1859 unsigned priority)
1860{
1861 unsigned char *buf;
1862 size_t len;

--- 1648 unchanged lines hidden ---