Hello community,

here is the log from the commit of package inih for openSUSE:Factory checked in 
at 2020-10-16 16:15:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/inih (Old)
 and      /work/SRC/openSUSE:Factory/.inih.new.3486 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "inih"

Fri Oct 16 16:15:32 2020 rev:2 rq:841999 version:52

Changes:
--------
--- /work/SRC/openSUSE:Factory/inih/inih.changes        2020-09-23 
18:40:58.173352691 +0200
+++ /work/SRC/openSUSE:Factory/.inih.new.3486/inih.changes      2020-10-16 
16:16:16.692727476 +0200
@@ -1,0 +2,9 @@
+Thu Oct 15 19:10:02 UTC 2020 - Matthias Bach <ma...@marix.org> - 52
+
+- Update to version 52
+  * Add INI_CUSTOM_ALLOCATOR to allow using a custom memory
+    allocator.
+- Drop workaround for library name not matching its soname as this
+  was fixed upstream.
+
+-------------------------------------------------------------------

Old:
----
  inih-r51.tar.gz

New:
----
  inih-r52.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ inih.spec ++++++
--- /var/tmp/diff_new_pack.UduCcC/_old  2020-10-16 16:16:17.672727776 +0200
+++ /var/tmp/diff_new_pack.UduCcC/_new  2020-10-16 16:16:17.692727782 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package inih
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 # Copyright (c) 2020 Matthias Bach <ma...@marix.org>
 #
 # All modifications and additions to the file contributed by third parties
@@ -13,18 +13,18 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           inih
-Version:        51
+Version:        52
 Release:        0
 Summary:        Simple .INI file parser in C, good for embedded systems
 License:        BSD-3-Clause
 Group:          Development/Libraries/C and C++
-Url:            https://github.com/benhoyt/inih
-Source:         
https://github.com/benhoyt/inih/archive/r51.tar.gz#/inih-r51.tar.gz
+URL:            https://github.com/benhoyt/inih
+Source:         
https://github.com/benhoyt/inih/archive/r%{version}.tar.gz#/inih-r%{version}.tar.gz
 BuildRequires:  gcc-c++
 BuildRequires:  meson
 BuildRequires:  pkgconfig
@@ -69,8 +69,6 @@
 
 %install
 %meson_install
-mv %{buildroot}%{_libdir}/libinih.so.49 %{buildroot}%{_libdir}/libinih.so.0
-mv %{buildroot}%{_libdir}/libINIReader.so.49 
%{buildroot}%{_libdir}/libINIReader.so.0
 
 %post -n libinih0 -p /sbin/ldconfig
 %postun -n libinih0 -p /sbin/ldconfig

++++++ inih-r51.tar.gz -> inih-r52.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/README.md new/inih-r52/README.md
--- old/inih-r51/README.md      2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/README.md      2020-10-13 10:25:18.000000000 +0200
@@ -35,6 +35,7 @@
   * **Maximum line length:** The default maximum line length (for stack or 
heap) is 200 bytes. To override this, add something like `-DINI_MAX_LINE=1000`. 
Note that `INI_MAX_LINE` must be 3 more than the longest line (due to `\r`, 
`\n`, and the NUL).
   * **Initial malloc size:** `INI_INITIAL_ALLOC` specifies the initial malloc 
size when using the heap. It defaults to 200 bytes.
   * **Allow realloc:** By default when using the heap (`-DINI_USE_STACK=0`), 
inih allocates a fixed-sized buffer of `INI_INITIAL_ALLOC` bytes. To allow this 
to grow to `INI_MAX_LINE` bytes, doubling if needed, set 
`-DINI_ALLOW_REALLOC=1`.
+  * **Custom allocator:** By default when using the heap, the standard 
library's `malloc`, `free`, and `realloc` functions are used; to use a custom 
allocator, specify `-DINI_CUSTOM_ALLOCATOR=1` (and `-DINI_USE_STACK=0`). You 
must define and link functions named `ini_malloc`, `ini_free`, and (if 
`INI_ALLOW_REALLOC` is set) `ini_realloc`, which must have the same signatures 
as the `stdlib.h` memory allocation functions.
 
 ## Simple example in C ##
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/cpp/INIReader.h new/inih-r52/cpp/INIReader.h
--- old/inih-r51/cpp/INIReader.h        2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/cpp/INIReader.h        2020-10-13 10:25:18.000000000 +0200
@@ -9,8 +9,8 @@
 //
 // https://github.com/benhoyt/inih
 
-#ifndef __INIREADER_H__
-#define __INIREADER_H__
+#ifndef INIREADER_H
+#define INIREADER_H
 
 #include <map>
 #include <string>
@@ -70,4 +70,4 @@
                             const char* value);
 };
 
-#endif  // __INIREADER_H__
+#endif  // INIREADER_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/ini.c new/inih-r52/ini.c
--- old/inih-r51/ini.c  2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/ini.c  2020-10-13 10:25:18.000000000 +0200
@@ -22,7 +22,17 @@
 #include "ini.h"
 
 #if !INI_USE_STACK
+#if INI_CUSTOM_ALLOCATOR
+#include <stddef.h>
+void* ini_malloc(size_t size);
+void ini_free(void* ptr);
+void* ini_realloc(void* ptr, size_t size);
+#else
 #include <stdlib.h>
+#define ini_malloc malloc
+#define ini_free free
+#define ini_realloc realloc
+#endif
 #endif
 
 #define MAX_SECTION 50
@@ -110,7 +120,7 @@
     int error = 0;
 
 #if !INI_USE_STACK
-    line = (char*)malloc(INI_INITIAL_ALLOC);
+    line = (char*)ini_malloc(INI_INITIAL_ALLOC);
     if (!line) {
         return -2;
     }
@@ -130,9 +140,9 @@
             max_line *= 2;
             if (max_line > INI_MAX_LINE)
                 max_line = INI_MAX_LINE;
-            new_line = realloc(line, max_line);
+            new_line = ini_realloc(line, max_line);
             if (!new_line) {
-                free(line);
+                ini_free(line);
                 return -2;
             }
             line = new_line;
@@ -224,7 +234,7 @@
     }
 
 #if !INI_USE_STACK
-    free(line);
+    ini_free(line);
 #endif
 
     return error;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/ini.h new/inih-r52/ini.h
--- old/inih-r51/ini.h  2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/ini.h  2020-10-13 10:25:18.000000000 +0200
@@ -11,8 +11,8 @@
 
 */
 
-#ifndef __INI_H__
-#define __INI_H__
+#ifndef INI_H
+#define INI_H
 
 /* Make this header file easier to include in C++ code */
 #ifdef __cplusplus
@@ -141,8 +141,17 @@
 #define INI_ALLOW_NO_VALUE 0
 #endif
 
+/* Nonzero to use custom ini_malloc, ini_free, and ini_realloc memory
+   allocation functions (INI_USE_STACK must also be 0). These functions must
+   have the same signatures as malloc/free/realloc and behave in a similar
+   way. ini_realloc is only needed if INI_ALLOW_REALLOC is set. */
+#ifndef INI_CUSTOM_ALLOCATOR
+#define INI_CUSTOM_ALLOCATOR 0
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* __INI_H__ */
+#endif /* INI_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/meson.build new/inih-r52/meson.build
--- old/inih-r51/meson.build    2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/meson.build    2020-10-13 10:25:18.000000000 +0200
@@ -2,11 +2,9 @@
     ['c','cpp'],
     default_options : ['default_library=static'],
     license : 'BSD-3-Clause',
-    version : '49'
 )
 
 #### options ####
-
 arg_static = []
 distro_install = get_option('distro_install')
 
@@ -47,11 +45,11 @@
     endif
     max_line_length = get_option('max_line_length')
     if max_line_length != 200
-        arg_static += ['-DINI_MAX_LINE=' + str(max_line_length)]
+        arg_static += ['-DINI_MAX_LINE=' + max_line_length.to_string()]
     endif
     initial_malloc_size = get_option('initial_malloc_size')
     if initial_malloc_size != 200
-        arg_static += ['-DINI_INITIAL_ALLOC=' + str(initial_malloc_size)]
+        arg_static += ['-DINI_INITIAL_ALLOC=' + 
initial_malloc_size.to_string()]
     endif
     if get_option('allow_realloc')
         arg_static += ['-DINI_ALLOW_REALLOC=1']
@@ -66,7 +64,6 @@
     include_directories : inc_inih,
     c_args : arg_static,
     install : distro_install,
-    version : meson.project_version(),
     soversion : '0'
 )
 
@@ -76,7 +73,6 @@
     pkg.generate(lib_inih,
         name : 'inih',
         description : 'simple .INI file parser',
-        version : meson.project_version()
     )
 endif
 
@@ -94,7 +90,6 @@
         include_directories : inc_INIReader,
         dependencies : inih_dep,
         install : distro_install,
-        version : meson.project_version(),
         soversion : '0'
     )
 
@@ -104,7 +99,6 @@
         pkg.generate(lib_INIReader,
             name : 'INIReader',
             description : 'simple .INI file parser for C++',
-            version : meson.project_version()
         )
     endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/tests/baseline_alloc.txt 
new/inih-r52/tests/baseline_alloc.txt
--- old/inih-r51/tests/baseline_alloc.txt       1970-01-01 01:00:00.000000000 
+0100
+++ new/inih-r52/tests/baseline_alloc.txt       2020-10-13 10:25:18.000000000 
+0200
@@ -0,0 +1,7 @@
+ini_malloc(12)
+... [section]
+... foo=bar;
+ini_realloc(24)
+... bazz=buzz quxx;
+ini_free()
+basic: e=0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/tests/unittest.bat 
new/inih-r52/tests/unittest.bat
--- old/inih-r51/tests/unittest.bat     2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/tests/unittest.bat     2020-10-13 10:25:18.000000000 +0200
@@ -11,3 +11,4 @@
 @call tcc ..\ini.c -I..\ -DINI_USE_STACK=0 -DINI_MAX_LINE=20 
-DINI_INITIAL_ALLOC=20 -run unittest.c > baseline_heap_string.txt
 @call tcc ..\ini.c -I..\ -DINI_CALL_HANDLER_ON_NEW_SECTION=1 -run unittest.c > 
baseline_call_handler_on_new_section.txt
 @call tcc ..\ini.c -I..\ -DINI_ALLOW_NO_VALUE=1 -run unittest.c > 
baseline_allow_no_value.txt
+@call tcc ..\ini.c -I..\ -DINI_CUSTOM_ALLOCATOR=1 -DINI_USE_STACK=0 
-DINI_ALLOW_REALLOC=1 -DINI_INITIAL_ALLOC=12 -run unittest_alloc.c > 
baseline_alloc.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/tests/unittest.sh 
new/inih-r52/tests/unittest.sh
--- old/inih-r51/tests/unittest.sh      2020-06-18 09:32:52.000000000 +0200
+++ new/inih-r52/tests/unittest.sh      2020-10-13 10:25:18.000000000 +0200
@@ -55,3 +55,7 @@
 gcc ../ini.c -DINI_ALLOW_NO_VALUE=1 unittest.c -o unittest_allow_no_value
 ./unittest_allow_no_value > baseline_allow_no_value.txt
 rm -f unittest_allow_no_value
+
+gcc -DINI_CUSTOM_ALLOCATOR=1 -DINI_USE_STACK=0 -DINI_ALLOW_REALLOC=1 
-DINI_INITIAL_ALLOC=12 ../ini.c unittest_alloc.c -o unittest_alloc
+./unittest_alloc > baseline_alloc.txt
+rm -f unittest_alloc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/inih-r51/tests/unittest_alloc.c 
new/inih-r52/tests/unittest_alloc.c
--- old/inih-r51/tests/unittest_alloc.c 1970-01-01 01:00:00.000000000 +0100
+++ new/inih-r52/tests/unittest_alloc.c 2020-10-13 10:25:18.000000000 +0200
@@ -0,0 +1,49 @@
+/* inih -- unit tests for custom memory allocator */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../ini.h"
+
+void* ini_malloc(size_t size) {
+    printf("ini_malloc(%d)\n", (int)size);
+    return malloc(size);
+}
+
+void ini_free(void* ptr) {
+    printf("ini_free()\n");
+    free(ptr);
+}
+
+void* ini_realloc(void* ptr, size_t size) {
+    printf("ini_realloc(%d)\n", (int)size);
+    return realloc(ptr, size);
+}
+
+char Prev_section[50];
+
+int dumper(void* user, const char* section, const char* name,
+           const char* value)
+{
+    if (strcmp(section, Prev_section)) {
+        printf("... [%s]\n", section);
+        strncpy(Prev_section, section, sizeof(Prev_section));
+        Prev_section[sizeof(Prev_section) - 1] = '\0';
+    }
+    printf("... %s=%s;\n", name, value);
+    return 1;
+}
+
+void parse(const char* name, const char* string) {
+    int e;
+
+    *Prev_section = '\0';
+    e = ini_parse_string(string, dumper, NULL);
+    printf("%s: e=%d\n", name, e);
+}
+
+int main(void)
+{
+    parse("basic", "[section]\nfoo = bar\nbazz = buzz quxx");
+    return 0;
+}


Reply via email to