Hello community, here is the log from the commit of package libeconf for openSUSE:Factory checked in at 2020-08-02 12:27:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libeconf (Old) and /work/SRC/openSUSE:Factory/.libeconf.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libeconf" Sun Aug 2 12:27:18 2020 rev:8 rq:820744 version:0.3.8+git20200710.5126fff Changes: -------- --- /work/SRC/openSUSE:Factory/libeconf/libeconf.changes 2020-06-07 21:34:07.132651373 +0200 +++ /work/SRC/openSUSE:Factory/.libeconf.new.3592/libeconf.changes 2020-08-02 12:27:21.455795440 +0200 @@ -1,0 +2,7 @@ +Fri Jul 10 21:15:09 UTC 2020 - [email protected] + +- Update to version 0.3.8+git20200710.5126fff: + * Add CMake build scripts, remove autotools support + * Move C++ ABI compatibility section + +------------------------------------------------------------------- Old: ---- libeconf-0.3.7+git20200605.c67ef9a.tar.xz New: ---- libeconf-0.3.8+git20200710.5126fff.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libeconf.spec ++++++ --- /var/tmp/diff_new_pack.tAeLEA/_old 2020-08-02 12:27:22.079796081 +0200 +++ /var/tmp/diff_new_pack.tAeLEA/_new 2020-08-02 12:27:22.083796086 +0200 @@ -18,7 +18,7 @@ %define lname libeconf0 Name: libeconf -Version: 0.3.7+git20200605.c67ef9a +Version: 0.3.8+git20200710.5126fff Release: 0 Summary: Enhanced config file parser ala systemd License: LGPL-2.1-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.tAeLEA/_old 2020-08-02 12:27:22.107796110 +0200 +++ /var/tmp/diff_new_pack.tAeLEA/_new 2020-08-02 12:27:22.107796110 +0200 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="version">0.3.7</param> - <param name="versionformat">0.3.7+git%cd.%h</param> + <param name="version">0.3.8</param> + <param name="versionformat">0.3.8+git%cd.%h</param> <param name="url">git://github.com/openSUSE/libeconf.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.tAeLEA/_old 2020-08-02 12:27:22.123796126 +0200 +++ /var/tmp/diff_new_pack.tAeLEA/_new 2020-08-02 12:27:22.123796126 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/openSUSE/libeconf.git</param> - <param name="changesrevision">37e14ba22a59b94ab2d43cdf2ffcb8e8732c9577</param> + <param name="changesrevision">5126fff683752fd640af10557214a5e50ad7b2ca</param> </service> </servicedata> \ No newline at end of file ++++++ libeconf-0.3.7+git20200605.c67ef9a.tar.xz -> libeconf-0.3.8+git20200710.5126fff.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/.github/workflows/ccpp.yml new/libeconf-0.3.8+git20200710.5126fff/.github/workflows/ccpp.yml --- old/libeconf-0.3.7+git20200605.c67ef9a/.github/workflows/ccpp.yml 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/.github/workflows/ccpp.yml 2020-07-10 23:13:49.000000000 +0200 @@ -9,16 +9,9 @@ steps: - uses: actions/checkout@v2 - - name: autogen.sh - run: ./autogen.sh - - name: configure with checks - run: ./configure --enable-compiler-checks - - name: make with compiler checks - run: make + - name: cmake configure with asan checks + run: cmake -B build -DCMAKE_BUILD_TYPE=SanitizeAddress + - name: make with asan checks + run: make -C build - name: make check - run: make check - - name: check_failure - if: failure() - run: cat tests/test-suite.log - - name: make distcheck - run: make distcheck + run: make -C build check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/CMakeLists.txt new/libeconf-0.3.8+git20200710.5126fff/CMakeLists.txt --- old/libeconf-0.3.7+git20200605.c67ef9a/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/CMakeLists.txt 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,71 @@ +cmake_minimum_required(VERSION 3.12) + +# Ensure built-in policies from CMake are used, (e.g. improved policies for macOS) +cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) + +project(libeconf VERSION 0.3.8 + DESCRIPTION "Enhanced config file parser, which merges config files placed in several locations into one." + LANGUAGES C + ) + +# Set up GNU conventions and standard FHS paths +include(GNUInstallDirs) + +# Activate CMake package configuration helpers +include(CMakePackageConfigHelpers) + +# Ensure _GNU_SOURCE is available +include(CheckSymbolExists) + +# check if _GNU_SOURCE is available + +if (NOT _GNU_SOURCE) + check_symbol_exists(__GNU_LIBRARY__ "features.h" _GNU_SOURCE) + + if (NOT _GNU_SOURCE) + unset(_GNU_SOURCE CACHE) + check_symbol_exists(_GNU_SOURCE "features.h" _GNU_SOURCE) + endif () +endif () + +if (_GNU_SOURCE) + add_definitions(-D_GNU_SOURCE) +endif () + + +# set the minimum C standard +set(CMAKE_C_STANDARD 11) + +# Build Types +set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} + CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel SanitizeAddress RelWithDebInfoStrict" + FORCE + ) + +# AddressSanitize +set(CMAKE_C_FLAGS_SANITIZEADDRESS + "-O2 -g -Wall -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" + CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." + FORCE + ) + +set(CMAKE_LINK_FLAGS_SANITIZEADDRESS + "-fsanitize=address" + CACHE STRING "Flags used by the linker during AddressSanitizer builds." + FORCE + ) + +# RelWithDebInfoStrict +set(CMAKE_C_FLAGS_RELWITHDEBINFOSTRICT + "-O2 -g -Werror -W -Wall -DXTSTRINGDEFINES -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=8 -Wbad-function-cast -Wcast-align -Wcast-qual -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef" + CACHE STRING "Flags used by the C compiler during strict RelWithDebInfo builds." + FORCE + ) + +add_subdirectory(lib) +add_subdirectory(example) + +# Enable testing +include(CTest) +enable_testing() +add_subdirectory(tests) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/INSTALL.md new/libeconf-0.3.8+git20200710.5126fff/INSTALL.md --- old/libeconf-0.3.7+git20200605.c67ef9a/INSTALL.md 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/INSTALL.md 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,33 @@ +# Building and installing libeconf + +libeconf supports two options to build it: Meson (preferred) or CMake (alternate) + +## Building with Meson + +libeconf requires a relatively recent version of Meson, version 0.49 or newer. + +Building with Meson is quite simple: + +```shell +$ meson build +$ ninja -C build +$ ninja -C build test +``` + +If you want to build with the address sanitizer enabled, add +`-Db_sanitize=address` as an argument to `meson build`. + +## Building with CMake + +libeconf requires CMake 3.12 or newer. + +Building with CMake is straightforward: + +```shell +$ cmake -B build +$ make -C build +$ make -C build check +``` + +If you want to build with the address sanitizer enabled, add +`-DCMAKE_BUILD_TYPE=SanitizeAddress` as an argument to `cmake -B build`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/Makefile.am new/libeconf-0.3.8+git20200710.5126fff/Makefile.am --- old/libeconf-0.3.7+git20200605.c67ef9a/Makefile.am 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -AUTOMAKE_OPTIONS = 1.6 foreign check-news dist-xz - -SUBDIRS = lib include bin tests - -ACLOCAL_AMFLAGS = -I m4 - -CLEANFILES = *~ - -EXTRA_DIST = LICENSE README.md TODO.md meson.build README.meson diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/NEWS new/libeconf-0.3.8+git20200710.5126fff/NEWS --- old/libeconf-0.3.7+git20200605.c67ef9a/NEWS 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/NEWS 2020-07-10 23:13:49.000000000 +0200 @@ -1,3 +1,12 @@ +Version 0.3.8 +* Convert the build to include CMake as an option, remove autotools + +Version 0.3.7 +* Fix issues identified with i586 build thanks to the move to meson + +Version 0.3.6 +* Add C++ compatibility and Add support for Meson + Version 0.3.5 * Initial Haiku Port * Bugfix: helpers.c - Check for empty value (NULL pointer) before calling strdup. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/README.meson new/libeconf-0.3.8+git20200710.5126fff/README.meson --- old/libeconf-0.3.7+git20200605.c67ef9a/README.meson 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/README.meson 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -This project is using meson to build everything. - -Requirements: meson >= 0.49 - -To build and compile: - -# meson build -# ninja -C build -# ninja -C build test - -Compiler checks: - -The replacement for the old "configure --enable-compiler-checks" is -now: "meson <build> -Db_sanitize=address" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/autogen.sh new/libeconf-0.3.8+git20200710.5126fff/autogen.sh --- old/libeconf-0.3.7+git20200605.c67ef9a/autogen.sh 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/autogen.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,12 +0,0 @@ -#!/bin/sh -x - -rm -fv ltmain.sh config.sub config.guess config.h.in aclocal.m4 -mkdir -p m4 -aclocal -I m4 -#autoheader -libtoolize --automake --copy -# Fix ltmain.sh for -fsanitize -sed -i -e 's/-stdlib=\*)/-stdlib=\*|-fsanitize=\*)/g' ltmain.sh -automake --add-missing --copy --force -autoreconf -chmod 755 configure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/bin/Makefile.am new/libeconf-0.3.8+git20200710.5126fff/bin/Makefile.am --- old/libeconf-0.3.7+git20200605.c67ef9a/bin/Makefile.am 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/bin/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -noinst_PROGRAMS = example -example_SOURCES = ../example/example.c -example_CFLAGS = @CFLAGS_CHECKS@ @CFLAGS_WARNINGS@ -I $(top_srcdir)/include -example_LDADD = @LDFLAGS_CHECKS@ @LDFLAGS_WARNINGS@ $(top_builddir)/lib/libeconf.la - -CLEANFILES = example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/cmake/libeconf.pc.in new/libeconf-0.3.8+git20200710.5126fff/cmake/libeconf.pc.in --- old/libeconf-0.3.7+git20200605.c67ef9a/cmake/libeconf.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/cmake/libeconf.pc.in 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ + +Libs: -L${libdir} -leconf -lm +Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/cmake/libeconfConfig.cmake.in new/libeconf-0.3.8+git20200710.5126fff/cmake/libeconfConfig.cmake.in --- old/libeconf-0.3.7+git20200605.c67ef9a/cmake/libeconfConfig.cmake.in 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/cmake/libeconfConfig.cmake.in 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include ("${CMAKE_CURRENT_LIST_DIR}/libeconfTargets.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/configure.ac new/libeconf-0.3.8+git20200710.5126fff/configure.ac --- old/libeconf-0.3.7+git20200605.c67ef9a/configure.ac 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/configure.ac 1970-01-01 01:00:00.000000000 +0100 @@ -1,46 +0,0 @@ -AC_INIT([libeconf], [0.3.5]) -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -AM_INIT_AUTOMAKE([subdir-objects]) - -AC_CONFIG_SRCDIR([lib/libeconf.c]) -AC_CONFIG_MACRO_DIRS([m4]) - -AC_PROG_CC -AC_GNU_SOURCE -AC_PROG_INSTALL -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL -LT_INIT([disable-static]) - -PKG_PROG_PKG_CONFIG -PKG_INSTALLDIR - -dnl enable additional compiler checks -AC_ARG_ENABLE([compiler-checks], - AS_HELP_STRING([--enable-compiler-checks],[enables additional compiler checks, not for production])) - -if test x"$enable_compiler_checks" = x"yes" ; then - CFLAGS_CHECKS="-Wall -O2 -fsanitize=address -fno-omit-frame-pointer -g" - LDFLAGS_CHECKS="-fsanitize=address" -fi - -dnl enable additional compiler warnings -AC_ARG_ENABLE([compiler-warnings], - AS_HELP_STRING([--enable-compiler-warnings],[enables additional compiler warnings])) - -if test x"$enable_compiler_warnings" = x"yes" ; then - if test x"$enable_compiler_checks" = x"yes" ; then - AC_MSG_ERROR([Conflicting options: --enable-compiler-warnings cannot be used together with --eanble-compiler-checks]) - fi - CFLAGS_WARNINGS="-O2 -g -Werror -W -Wall -DXTSTRINGDEFINES -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=8 -Wbad-function-cast -Wcast-align -Wcast-qual -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef" - LDFLAGS_WARNINGS="" -fi - -AC_SUBST(CFLAGS_CHECKS) -AC_SUBST(LDFLAGS_CHECKS) -AC_SUBST(CFLAGS_WARNINGS) -AC_SUBST(LDFLAGS_WARNINGS) -AC_CONFIG_FILES([Makefile lib/Makefile include/Makefile bin/Makefile tests/Makefile lib/libeconf.pc]) -AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/example/CMakeLists.txt new/libeconf-0.3.8+git20200710.5126fff/example/CMakeLists.txt --- old/libeconf-0.3.7+git20200605.c67ef9a/example/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/example/CMakeLists.txt 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,3 @@ +# Create the binary/executable +add_executable(example EXCLUDE_FROM_ALL example.c) +target_link_libraries(example PRIVATE econf) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/Makefile.am new/libeconf-0.3.8+git20200710.5126fff/include/Makefile.am --- old/libeconf-0.3.7+git20200605.c67ef9a/include/Makefile.am 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -include_HEADERS = libeconf.h - -EXTRA_DIST = defines.h getfilecontents.h helpers.h keyfile.h mergefiles.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/defines.h new/libeconf-0.3.8+git20200710.5126fff/include/defines.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/defines.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/defines.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -/* - Copyright (C) 2019 LLC - Author: Pascal Arlt <[email protected]> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -/* --- defines.h --- */ - -#include "../include/helpers.h" - -/* Defines default values used in the library */ - -/* Default econf_file length on creation */ -#define KEY_FILE_DEFAULT_LENGTH 8 - -/* NULL value */ -#define KEY_FILE_NULL_VALUE "_none_" -#define KEY_FILE_NULL_VALUE_HASH hashstring(KEY_FILE_NULL_VALUE) - -/* Bool values */ -#define YES hashstring("yes") -#define NO hashstring("no") -#define TRUE hashstring("true") -#define FALSE hashstring("false") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/getfilecontents.h new/libeconf-0.3.8+git20200710.5126fff/include/getfilecontents.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/getfilecontents.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/getfilecontents.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -/* - Copyright (C) 2019 SUSE LLC - Author: Pascal Arlt <[email protected]> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -#include "libeconf.h" -#include "keyfile.h" - -/* Fill the econf_file struct with values from the given file */ -extern econf_err read_file(econf_file *read_file, const char *file, - const char *delim, const char *comment); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/helpers.h new/libeconf-0.3.8+git20200710.5126fff/include/helpers.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/helpers.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/helpers.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,74 +0,0 @@ -/* - Copyright (C) 2019 SUSE LLC - Author: Pascal Arlt <[email protected]> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -/* -- helpers.h --- */ - -#include "keyfile.h" - -/* This file contains the declaration of functions used by other functions to - perform certain basic tasks on multiple instances. */ - - -/* Combine the two given strings with the given delimiter and return the - resulting string. */ -char *combine_strings(const char *string_one, const char *string_two, - const char delimiter); - -/* Remove whitespace from beginning and end, append string terminator */ -char *clearblank(size_t *vlen, char *string); - -/* Returns the absolute path of a given path */ -char *get_absolute_path(const char *path, econf_err *error); - -/* Remove '[' and ']' from beginning and end */ -/* TODO: Function is currently not in use. But needs to be used to strip - the brackets from group elements before returning them to the user */ -char *stripbrackets(char *string); - -/* Add '[' and ']' to the given string */ -char *addbrackets(const char *string); - -/* Set default value defined in include/defines.h */ -void initialize(econf_file *key_file, size_t num); - -/* Return the lower case version of a string */ -char *toLowerCase(char *str); - -/* Turn given string into a hash value */ -size_t hashstring(const char *str); - -/* Look for a matching key in the given econf_file. - If the key is found num will point to the number of the array which contains - the key, if not it will point to -1. */ -econf_err find_key(econf_file key_file, const char *group, const char *key, size_t *num); - -/* Set value for the given group, key combination. If the combination - does not exist it is created. */ -econf_err setKeyValue(econf_err (*function) (econf_file*, size_t, const void*), - econf_file *kf, const char *group, const char *key, - const void *value); - -/* Copy the contents of a file_entry struct */ -struct file_entry cpy_file_entry(struct file_entry fe); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/keyfile.h new/libeconf-0.3.8+git20200710.5126fff/include/keyfile.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/keyfile.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/keyfile.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,101 +0,0 @@ -/* - Copyright (C) 2019 SUSE LLC - Author: Pascal Arlt <[email protected]> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -/* --- keyfile.h --- */ - -#include <stdint.h> -#include <stdbool.h> -#include <stdlib.h> - -/* This file contains the definition of the econf_file struct declared in - libeconf.h as well as the functions to get and set a specified element - of the struct. All functions return an error code != 0 on error defined - in libeconf.h. */ - - -/* Definition of the econf_file struct and its inner file_entry struct. */ -typedef struct econf_file { - /* The file_entry struct contains the group, key and value of every - key/value entry found in a config file or set via the set functions. If no - group is found or provided the group is set to KEY_FILE_NULL_VALUE. */ - struct file_entry { - char *group, *key, *value; - uint64_t line_number; - } * file_entry; - /* length represents the current amount of key/value entries in econf_file and - alloc_length the the amount of currently allocated file_entry elements - within the struct. If length would exceed alloc_length it's increased. */ - size_t length, alloc_length; - /* delimiter: char used to assign a value to a key - comment: Used to specify which char to regard as comment indicator. */ - /* TODO: Should eventually be of type *char to allow multiple character - delimiters and comment indicators. - Alternatively they could be removed from the struct and be passed - as parameters to the read/write functions for config files */ - char delimiter, comment; - /* Binary variable to determine whether econf_file should be freed after - being merged with another econf_file. */ - bool on_merge_delete; - char *path; -} econf_file; - -/* Increases both length and alloc_length of key_file by one and initializes - new elements of struct file_entry. */ -econf_err key_file_append(econf_file *key_file); - -/* GETTERS */ - -/* Functions used to get a set value from key_file depending on num. - Expects a pointer of fitting type and writes the result into the pointer. - num corresponds to the respective instance of the file_entry array. - TODO: Error checking and defining return value on error needs to done. */ -econf_err getIntValueNum(econf_file key_file, size_t num, int32_t *result); -econf_err getInt64ValueNum(econf_file key_file, size_t num, int64_t *result); -econf_err getUIntValueNum(econf_file key_file, size_t num, uint32_t *result); -econf_err getUInt64ValueNum(econf_file key_file, size_t num, uint64_t *result); -econf_err getFloatValueNum(econf_file key_file, size_t num, float *result); -econf_err getDoubleValueNum(econf_file key_file, size_t num, double *result); -econf_err getStringValueNum(econf_file key_file, size_t num, char **result); -econf_err getBoolValueNum(econf_file key_file, size_t num, bool *result); - -/* SETTERS */ - -/* Set the group of the file_entry element number num */ -econf_err setGroup(econf_file *key_file, size_t num, const char *value); -/* Set the key of the file_entry element number num */ -econf_err setKey(econf_file *key_file, size_t num, const char *value); - -/* Functions used to set a value from key_file depending on num. - Expects a void pointer to the value which is cast to the corresponding - type inside the function. num corresponds to the respective instance of the - file_entry array. */ -econf_err setIntValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setInt64ValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setUIntValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setUInt64ValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setFloatValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setDoubleValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setStringValueNum(econf_file *key_file, size_t num, const void *value); -econf_err setBoolValueNum(econf_file *key_file, size_t num, const void *value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/libeconf.h new/libeconf-0.3.8+git20200710.5126fff/include/libeconf.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/libeconf.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/libeconf.h 2020-07-10 23:13:49.000000000 +0200 @@ -25,14 +25,14 @@ /* libeconf.h */ -#ifdef __cplusplus -extern "C" { -#endif - #include <stdbool.h> #include <stdint.h> #include <stdlib.h> +#ifdef __cplusplus +extern "C" { +#endif + /* Public API for the econf library */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/include/mergefiles.h new/libeconf-0.3.8+git20200710.5126fff/include/mergefiles.h --- old/libeconf-0.3.7+git20200605.c67ef9a/include/mergefiles.h 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/include/mergefiles.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,56 +0,0 @@ -/* - Copyright (C) 2019 SUSE LLC - Author: Pascal Arlt <[email protected]> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -#pragma once - -#include "keyfile.h" - -#include <stddef.h> - -/* This file contains the declaration of the functions used by econf_mergeFiles - to merge the contents of two econf_files. */ - - -/* Insert the content of "etc_file.file_entry" into "fe" if there is no - group specified. */ -size_t insert_nogroup(struct file_entry **fe, econf_file *ef); - -/* Merge contents from existing usr_file groups */ -size_t merge_existing_groups(struct file_entry **fe, econf_file *uf, econf_file *ef, - const size_t etc_start); - -/* Add entries from etc_file exclusive groups */ -size_t add_new_groups(struct file_entry **fe, econf_file *uf, econf_file *ef, - const size_t merge_length); - -/* Returns the default dirs to iterate through when merging */ -char **get_default_dirs(const char *usr_conf_dir, const char *etc_conf_dir); - -/* Receives a list of config directories to look for and calls 'check_conf_dir' */ -econf_file **traverse_conf_dirs(econf_file **key_files, const char *conf_dirs[], - size_t *size, const char *path, - const char *config_suffix, - const char *delim, const char *comment); - -/* Merge an array of given econf_files into one */ -econf_err merge_econf_files(econf_file **key_files, econf_file **merged_files); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/CMakeLists.txt new/libeconf-0.3.8+git20200710.5126fff/lib/CMakeLists.txt --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/CMakeLists.txt 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,72 @@ +# Create the library +set(econf_SRCS libeconf.c + getfilecontents.c + mergefiles.c + helpers.c + keyfile.c + econf_errString.c + get_value_def.c + ) + +set(econf_HDRS defines.h + getfilecontents.h + mergefiles.h + helpers.h + keyfile.h + ) + +add_library(econf SHARED ${econf_SRCS} ${econf_HDRS} "${PROJECT_SOURCE_DIR}/include/libeconf.h") + +target_include_directories(econf PUBLIC + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> +) + +set_target_properties(econf PROPERTIES + SOVERSION ${PROJECT_VERSION_MAJOR} + VERSION ${PROJECT_VERSION} + COMPILE_FLAGS "-D_REENTRANT=1" + C_STANDARD 11 + C_STANDARD_REQUIRED ON + PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/include/libeconf.h" + LINK_FLAGS "-Wl,--no-undefined -Wl,--version-script,\"${PROJECT_SOURCE_DIR}/lib/libeconf.map\"" +) + +# Install the library +configure_file(${PROJECT_SOURCE_DIR}/cmake/libeconf.pc.in ${CMAKE_BINARY_DIR}/libeconf.pc @ONLY) +install(FILES ${CMAKE_BINARY_DIR}/libeconf.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) +install(TARGETS econf + EXPORT libeconfTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# Generate and install the exports +export(EXPORT libeconfTargets + FILE ${CMAKE_BINARY_DIR}/libeconfTargets.cmake +) +install(EXPORT libeconfTargets + FILE libeconfTargets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libeconf +) +configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/libeconfConfig.cmake.in + ${CMAKE_BINARY_DIR}/libeconfConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libeconf + NO_SET_AND_CHECK_MACRO + NO_CHECK_REQUIRED_COMPONENTS_MACRO +) +install(FILES + ${CMAKE_BINARY_DIR}/libeconfConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libeconf +) +write_basic_package_version_file( + ${CMAKE_BINARY_DIR}/libeconfConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMinorVersion +) +install(FILES + ${CMAKE_BINARY_DIR}/libeconfConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libeconf +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/Makefile.am new/libeconf-0.3.8+git20200710.5126fff/lib/Makefile.am --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/Makefile.am 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -lib_LTLIBRARIES = libeconf.la -libeconf_la_SOURCES = libeconf.c getfilecontents.c mergefiles.c \ - helpers.c keyfile.c econf_errString.c get_value_def.c -libeconf_la_CFLAGS = -D_REENTRANT=1 @CFLAGS_CHECKS@ @CFLAGS_WARNINGS@ -libeconf_la_CPPFLAGS = -I$(top_srcdir)/include -libeconf_la_LDFLAGS = @LDFLAGS_CHECKS@ @CFLAGS_WARNINGS@ \ - -version-info 3:1:3 -Wl,--no-undefined \ - -Wl,--version-script=$(top_srcdir)/lib/libeconf.map - -CLEANFILES = *~ -DISTCLEANFILES = *.pc -EXTRA_DIST = libeconf.map -pkgconfig_DATA = libeconf.pc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/defines.h new/libeconf-0.3.8+git20200710.5126fff/lib/defines.h --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/defines.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/defines.h 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,43 @@ +/* + Copyright (C) 2019 LLC + Author: Pascal Arlt <[email protected]> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#pragma once + +/* --- defines.h --- */ + +#include "helpers.h" + +/* Defines default values used in the library */ + +/* Default econf_file length on creation */ +#define KEY_FILE_DEFAULT_LENGTH 8 + +/* NULL value */ +#define KEY_FILE_NULL_VALUE "_none_" +#define KEY_FILE_NULL_VALUE_HASH hashstring(KEY_FILE_NULL_VALUE) + +/* Bool values */ +#define YES hashstring("yes") +#define NO hashstring("no") +#define TRUE hashstring("true") +#define FALSE hashstring("false") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/getfilecontents.c new/libeconf-0.3.8+git20200710.5126fff/lib/getfilecontents.c --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/getfilecontents.c 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/getfilecontents.c 2020-07-10 23:13:49.000000000 +0200 @@ -22,9 +22,9 @@ */ #include "libeconf.h" -#include "../include/defines.h" -#include "../include/getfilecontents.h" -#include "../include/helpers.h" +#include "defines.h" +#include "getfilecontents.h" +#include "helpers.h" #include <errno.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/getfilecontents.h new/libeconf-0.3.8+git20200710.5126fff/lib/getfilecontents.h --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/getfilecontents.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/getfilecontents.h 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,31 @@ +/* + Copyright (C) 2019 SUSE LLC + Author: Pascal Arlt <[email protected]> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#pragma once + +#include "libeconf.h" +#include "keyfile.h" + +/* Fill the econf_file struct with values from the given file */ +extern econf_err read_file(econf_file *read_file, const char *file, + const char *delim, const char *comment); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/helpers.c new/libeconf-0.3.8+git20200710.5126fff/lib/helpers.c --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/helpers.c 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/helpers.c 2020-07-10 23:13:49.000000000 +0200 @@ -22,8 +22,8 @@ */ #include "libeconf.h" -#include "../include/defines.h" -#include "../include/helpers.h" +#include "defines.h" +#include "helpers.h" #include <ctype.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/helpers.h new/libeconf-0.3.8+git20200710.5126fff/lib/helpers.h --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/helpers.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/helpers.h 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,74 @@ +/* + Copyright (C) 2019 SUSE LLC + Author: Pascal Arlt <[email protected]> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#pragma once + +/* -- helpers.h --- */ + +#include "keyfile.h" + +/* This file contains the declaration of functions used by other functions to + perform certain basic tasks on multiple instances. */ + + +/* Combine the two given strings with the given delimiter and return the + resulting string. */ +char *combine_strings(const char *string_one, const char *string_two, + const char delimiter); + +/* Remove whitespace from beginning and end, append string terminator */ +char *clearblank(size_t *vlen, char *string); + +/* Returns the absolute path of a given path */ +char *get_absolute_path(const char *path, econf_err *error); + +/* Remove '[' and ']' from beginning and end */ +/* TODO: Function is currently not in use. But needs to be used to strip + the brackets from group elements before returning them to the user */ +char *stripbrackets(char *string); + +/* Add '[' and ']' to the given string */ +char *addbrackets(const char *string); + +/* Set default value defined in include/defines.h */ +void initialize(econf_file *key_file, size_t num); + +/* Return the lower case version of a string */ +char *toLowerCase(char *str); + +/* Turn given string into a hash value */ +size_t hashstring(const char *str); + +/* Look for a matching key in the given econf_file. + If the key is found num will point to the number of the array which contains + the key, if not it will point to -1. */ +econf_err find_key(econf_file key_file, const char *group, const char *key, size_t *num); + +/* Set value for the given group, key combination. If the combination + does not exist it is created. */ +econf_err setKeyValue(econf_err (*function) (econf_file*, size_t, const void*), + econf_file *kf, const char *group, const char *key, + const void *value); + +/* Copy the contents of a file_entry struct */ +struct file_entry cpy_file_entry(struct file_entry fe); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/keyfile.c new/libeconf-0.3.8+git20200710.5126fff/lib/keyfile.c --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/keyfile.c 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/keyfile.c 2020-07-10 23:13:49.000000000 +0200 @@ -22,9 +22,9 @@ */ #include "libeconf.h" -#include "../include/defines.h" -#include "../include/helpers.h" -#include "../include/keyfile.h" +#include "defines.h" +#include "helpers.h" +#include "keyfile.h" #include <errno.h> #include <float.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/keyfile.h new/libeconf-0.3.8+git20200710.5126fff/lib/keyfile.h --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/keyfile.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/keyfile.h 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,101 @@ +/* + Copyright (C) 2019 SUSE LLC + Author: Pascal Arlt <[email protected]> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#pragma once + +/* --- keyfile.h --- */ + +#include <stdint.h> +#include <stdbool.h> +#include <stdlib.h> + +/* This file contains the definition of the econf_file struct declared in + libeconf.h as well as the functions to get and set a specified element + of the struct. All functions return an error code != 0 on error defined + in libeconf.h. */ + + +/* Definition of the econf_file struct and its inner file_entry struct. */ +typedef struct econf_file { + /* The file_entry struct contains the group, key and value of every + key/value entry found in a config file or set via the set functions. If no + group is found or provided the group is set to KEY_FILE_NULL_VALUE. */ + struct file_entry { + char *group, *key, *value; + uint64_t line_number; + } * file_entry; + /* length represents the current amount of key/value entries in econf_file and + alloc_length the the amount of currently allocated file_entry elements + within the struct. If length would exceed alloc_length it's increased. */ + size_t length, alloc_length; + /* delimiter: char used to assign a value to a key + comment: Used to specify which char to regard as comment indicator. */ + /* TODO: Should eventually be of type *char to allow multiple character + delimiters and comment indicators. + Alternatively they could be removed from the struct and be passed + as parameters to the read/write functions for config files */ + char delimiter, comment; + /* Binary variable to determine whether econf_file should be freed after + being merged with another econf_file. */ + bool on_merge_delete; + char *path; +} econf_file; + +/* Increases both length and alloc_length of key_file by one and initializes + new elements of struct file_entry. */ +econf_err key_file_append(econf_file *key_file); + +/* GETTERS */ + +/* Functions used to get a set value from key_file depending on num. + Expects a pointer of fitting type and writes the result into the pointer. + num corresponds to the respective instance of the file_entry array. + TODO: Error checking and defining return value on error needs to done. */ +econf_err getIntValueNum(econf_file key_file, size_t num, int32_t *result); +econf_err getInt64ValueNum(econf_file key_file, size_t num, int64_t *result); +econf_err getUIntValueNum(econf_file key_file, size_t num, uint32_t *result); +econf_err getUInt64ValueNum(econf_file key_file, size_t num, uint64_t *result); +econf_err getFloatValueNum(econf_file key_file, size_t num, float *result); +econf_err getDoubleValueNum(econf_file key_file, size_t num, double *result); +econf_err getStringValueNum(econf_file key_file, size_t num, char **result); +econf_err getBoolValueNum(econf_file key_file, size_t num, bool *result); + +/* SETTERS */ + +/* Set the group of the file_entry element number num */ +econf_err setGroup(econf_file *key_file, size_t num, const char *value); +/* Set the key of the file_entry element number num */ +econf_err setKey(econf_file *key_file, size_t num, const char *value); + +/* Functions used to set a value from key_file depending on num. + Expects a void pointer to the value which is cast to the corresponding + type inside the function. num corresponds to the respective instance of the + file_entry array. */ +econf_err setIntValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setInt64ValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setUIntValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setUInt64ValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setFloatValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setDoubleValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setStringValueNum(econf_file *key_file, size_t num, const void *value); +econf_err setBoolValueNum(econf_file *key_file, size_t num, const void *value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/libeconf.c new/libeconf-0.3.8+git20200710.5126fff/lib/libeconf.c --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/libeconf.c 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/libeconf.c 2020-07-10 23:13:49.000000000 +0200 @@ -21,13 +21,13 @@ SOFTWARE. */ -#include "../include/libeconf.h" +#include "libeconf.h" -#include "../include/defines.h" -#include "../include/getfilecontents.h" -#include "../include/helpers.h" -#include "../include/keyfile.h" -#include "../include/mergefiles.h" +#include "defines.h" +#include "getfilecontents.h" +#include "helpers.h" +#include "keyfile.h" +#include "mergefiles.h" #include <dirent.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/libeconf.pc.in new/libeconf-0.3.8+git20200710.5126fff/lib/libeconf.pc.in --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/libeconf.pc.in 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/libeconf.pc.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: @PACKAGE@ -Description: TODO -Version: @VERSION@ - -Libs: -L${libdir} -leconf -lm -Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/mergefiles.c new/libeconf-0.3.8+git20200710.5126fff/lib/mergefiles.c --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/mergefiles.c 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/mergefiles.c 2020-07-10 23:13:49.000000000 +0200 @@ -22,9 +22,9 @@ */ #include "libeconf.h" -#include "../include/defines.h" -#include "../include/helpers.h" -#include "../include/mergefiles.h" +#include "defines.h" +#include "helpers.h" +#include "mergefiles.h" #include <dirent.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/lib/mergefiles.h new/libeconf-0.3.8+git20200710.5126fff/lib/mergefiles.h --- old/libeconf-0.3.7+git20200605.c67ef9a/lib/mergefiles.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/lib/mergefiles.h 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,56 @@ +/* + Copyright (C) 2019 SUSE LLC + Author: Pascal Arlt <[email protected]> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#pragma once + +#include "keyfile.h" + +#include <stddef.h> + +/* This file contains the declaration of the functions used by econf_mergeFiles + to merge the contents of two econf_files. */ + + +/* Insert the content of "etc_file.file_entry" into "fe" if there is no + group specified. */ +size_t insert_nogroup(struct file_entry **fe, econf_file *ef); + +/* Merge contents from existing usr_file groups */ +size_t merge_existing_groups(struct file_entry **fe, econf_file *uf, econf_file *ef, + const size_t etc_start); + +/* Add entries from etc_file exclusive groups */ +size_t add_new_groups(struct file_entry **fe, econf_file *uf, econf_file *ef, + const size_t merge_length); + +/* Returns the default dirs to iterate through when merging */ +char **get_default_dirs(const char *usr_conf_dir, const char *etc_conf_dir); + +/* Receives a list of config directories to look for and calls 'check_conf_dir' */ +econf_file **traverse_conf_dirs(econf_file **key_files, const char *conf_dirs[], + size_t *size, const char *path, + const char *config_suffix, + const char *delim, const char *comment); + +/* Merge an array of given econf_files into one */ +econf_err merge_econf_files(econf_file **key_files, econf_file **merged_files); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/meson.build new/libeconf-0.3.8+git20200710.5126fff/meson.build --- old/libeconf-0.3.7+git20200605.c67ef9a/meson.build 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/meson.build 2020-07-10 23:13:49.000000000 +0200 @@ -7,7 +7,7 @@ 'b_pie=true', 'warning_level=3',], license : 'MIT', - version : '0.3.5', + version : '0.3.8', ) cc = meson.get_compiler('c') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/tests/CMakeLists.txt new/libeconf-0.3.8+git20200710.5126fff/tests/CMakeLists.txt --- old/libeconf-0.3.7+git20200605.c67ef9a/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libeconf-0.3.8+git20200710.5126fff/tests/CMakeLists.txt 2020-07-10 23:13:49.000000000 +0200 @@ -0,0 +1,55 @@ +# Set make check target +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) + +# Set up macro for building and adding tests +macro(BuildAndAddTest TESTNAME) + if (${TESTNAME} STREQUAL "tst-getconfdirs2") + add_executable(${TESTNAME} EXCLUDE_FROM_ALL tst-getconfdirs1.c) + else() + add_executable(${TESTNAME} EXCLUDE_FROM_ALL ${TESTNAME}.c) + endif() + target_link_libraries(${TESTNAME} PRIVATE econf) + if (${TESTNAME} STREQUAL "tst-getconfdirs1") + target_compile_options(${TESTNAME} PRIVATE -DTESTSDIR=\"${PROJECT_SOURCE_DIR}/tests/\" -DSUFFIX=\".conf\") + elseif (${TESTNAME} STREQUAL "tst-getconfdirs2") + target_compile_options(${TESTNAME} PRIVATE -DTESTSDIR=\"${PROJECT_SOURCE_DIR}/tests/\" -DSUFFIX=\"conf\") + else() + target_compile_options(${TESTNAME} PRIVATE -DTESTSDIR=\"${PROJECT_SOURCE_DIR}/tests/\") + endif() + add_test(NAME ${TESTNAME} COMMAND ${TESTNAME}) + add_dependencies(check ${TESTNAME}) +endmacro() + +set(TESTS tst-filedoesnotexit1 + tst-merge1 + tst-merge2 + tst-merge3 + tst-merge4 + tst-merge5 + tst-logindefs1 + tst-logindefs2 + tst-arguments1 + tst-arguments2 + tst-arguments3 + tst-arguments4 + tst-arguments5 + tst-getconfdirs1 + tst-getconfdirs2 + tst-getconfdirs3 + tst-getconfdirs4 + tst-getconfdirs5 + tst-getconfdirs6 + tst-getconfdirs7 + tst-econf_errstring1 + tst-setgetvalues1 + tst-groups1 + tst-groups2 + tst-groups3 + tst-groups4 + tst-parseconfig1 + tst-quote1 + ) + +foreach (TESTCASE ${TESTS}) + BuildAndAddTest(${TESTCASE}) +endforeach() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libeconf-0.3.7+git20200605.c67ef9a/tests/Makefile.am new/libeconf-0.3.8+git20200710.5126fff/tests/Makefile.am --- old/libeconf-0.3.7+git20200605.c67ef9a/tests/Makefile.am 2020-06-05 17:55:16.000000000 +0200 +++ new/libeconf-0.3.8+git20200710.5126fff/tests/Makefile.am 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ - -AM_CFLAGS = @CFLAGS_CHECKS@ @CFLAGS_WARNINGS@ -I$(top_srcdir)/include -DTESTSDIR=\"$(top_srcdir)/tests/\" -LDADD = @LDFLAGS_CHECKS@ @LDFLAGS_WARNINGS@ $(top_builddir)/lib/libeconf.la - -CLEANFILES = *~ - -EXTRA_DIST = meson.build \ - tst-arguments-data tst-logindefs1-data tst-logindefs2-data \ - tst-merge1-data tst-merge2-data tst-merge3-data tst-merge4-data \ - tst-merge5-data \ - tst-getconfdirs1-data tst-getconfdirs3-data \ - tst-getconfdirs4-data tst-getconfdirs5-data tst-getconfdirs6-data \ - tst-getconfdirs7-data \ - tst-arguments5-data tst-groups3-data tst-parseconfig-data \ - tst-quote1-data - -TESTS = tst-filedoesnotexit1 tst-merge1 tst-merge2 tst-merge3 tst-merge4 \ - tst-merge5 \ - tst-logindefs1 tst-logindefs2 \ - tst-arguments1 tst-arguments2 tst-arguments3 tst-arguments4 \ - tst-arguments5 \ - tst-getconfdirs1 tst-getconfdirs2 tst-getconfdirs3 \ - tst-getconfdirs4 tst-getconfdirs5 tst-getconfdirs6 \ - tst-getconfdirs7 \ - tst-econf_errstring1 \ - tst-setgetvalues1 \ - tst-groups1 tst-groups2 tst-groups3 tst-groups4 \ - tst-parseconfig1 \ - tst-quote1 - -XFAIL_TESTS = - -check_PROGRAMS = ${TESTS} - -tst_getconfdirs1_CFLAGS = $(AM_CFLAGS) -DSUFFIX=\".conf\" -tst_getconfdirs2_CFLAGS = $(AM_CFLAGS) -DSUFFIX=\"conf\" - -tst_getconfdirs2_SOURCES = tst-getconfdirs1.c
