Hello community, here is the log from the commit of package lua51-mpack for openSUSE:Factory checked in at 2016-10-10 16:24:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua51-mpack (Old) and /work/SRC/openSUSE:Factory/.lua51-mpack.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua51-mpack" Changes: -------- --- /work/SRC/openSUSE:Factory/lua51-mpack/lua51-mpack.changes 2016-04-30 23:29:55.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.lua51-mpack.new/lua51-mpack.changes 2016-10-10 16:24:59.000000000 +0200 @@ -1,0 +2,6 @@ +Sat Oct 8 23:48:19 UTC 2016 - roni...@gmail.com + +- Version bump to 1.0.3. + * No changelog available. + +------------------------------------------------------------------- Old: ---- 1.0.2.tar.gz New: ---- 1.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua51-mpack.spec ++++++ --- /var/tmp/diff_new_pack.jRQ6a7/_old 2016-10-10 16:25:00.000000000 +0200 +++ /var/tmp/diff_new_pack.jRQ6a7/_new 2016-10-10 16:25:00.000000000 +0200 @@ -19,7 +19,7 @@ %define lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2) %define lua_archdir %{_libdir}/lua/%{lua_version} Name: lua51-mpack -Version: 1.0.2 +Version: 1.0.3 Release: 0 Summary: Implementation of MessagePack for Lua 5.1 License: MIT @@ -39,12 +39,22 @@ %prep %setup -q -n libmpack-%{version} +# Fix lua directory. +pushd binding/lua +sed -i 's|LUA_CMOD_INSTALLDIR :=.*|LUA_CMOD_INSTALLDIR := $(shell echo "%{_libdir}/lua/$(LUA_VERSION_MAJ_MIN)")|g' Makefile +popd + %build -gcc -O2 -I%{_includedir}/lua/%{lua_version} -shared -fPIC -o mpack.so binding/lua/lmpack.c +pushd binding/lua +make USE_SYSTEM_LUA=yes +popd %install -mkdir -p %{buildroot}%{lua_archdir} -install -Dm755 mpack.so %{buildroot}%{lua_archdir} +pushd binding/lua +make USE_SYSTEM_LUA=yes \ + DESTDIR=%{buildroot} \ + install +popd %files %defattr(-,root,root) ++++++ 1.0.2.tar.gz -> 1.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/Makefile new/libmpack-1.0.3/Makefile --- old/libmpack-1.0.2/Makefile 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/Makefile 2016-09-18 22:09:16.000000000 +0200 @@ -1,3 +1,6 @@ +# Some parts of this Makefile were taken or adapted from libunibilium: +# https://github.com/mauke/unibilium + config ?= debug SYSTEM ?= $(shell uname -s) @@ -20,11 +23,6 @@ SYMBOLIZER ?= /usr/bin/llvm-symbolizer -.PHONY: all gdb lib-bin test-bin tools amalgamation test coverage profile clean \ - compile_commands.json - -all: lib-bin test-bin - XCFLAGS += -Wall -Wextra -Wconversion -Wstrict-prototypes -pedantic ifeq ($(ANSI),1) @@ -36,11 +34,15 @@ endif NAME := mpack -MAJOR := 0 +MAJOR := 1 MINOR := 0 -PATCH := 0 +PATCH := 3 VERSION := $(MAJOR).$(MINOR).$(PATCH) +LT_REVISION=0 +LT_CURRENT=0 +LT_AGE=0 + PREFIX ?= /usr/local LIBDIR ?= $(PREFIX)/lib INCDIR ?= $(PREFIX)/include @@ -53,7 +55,8 @@ SRC := $(addprefix $(SRCDIR)/,$(SRC)) HDRS := $(SRC:.c=.h) OBJ := $(addprefix $(OUTDIR)/,$(SRC:.c=.lo)) -LIB := $(OUTDIR)/lib$(NAME).la +LIBRARY := lib$(NAME).la +LIB := $(OUTDIR)/$(LIBRARY) TSRC := $(wildcard $(TESTDIR)/*.c) $(TESTDIR)/deps/tap/tap.c TOBJ := $(addprefix $(OUTDIR)/,$(TSRC:.c=.lo)) TEXE := $(OUTDIR)/run-tests @@ -64,37 +67,69 @@ TEST_FILTER_OUT := --coverage -ansi -std=c99 -include .config/$(config).mk +.PHONY: all +all: lib-bin test-bin -$(TOBJ): XCFLAGS := $(filter-out $(TEST_FILTER_OUT),$(XCFLAGS)) \ - -std=gnu99 -Wno-conversion -Wno-unused-parameter +include .config/$(config).mk +.PHONY: tools tools: $(COMPILER) $(RUNNER) +.PHONY: amalgamation amalgamation: $(AMALG) +.PHONY: lib-bin lib-bin: tools $(LIB) +.PHONY: test-bin test-bin: lib-bin $(TEXE) +.PHONY: test test: test-bin @$(RUNNER) $(TEXE) +.PHONY: gdb gdb: test-bin - gdb -x .gdb $(TEXE) + $(LIBTOOL) --mode=execute gdb -x .gdb $(TEXE) +.PHONY: coverage coverage: tools $(COVOUT) cat $(COVOUT) +.PHONY: profile profile: tools $(PROFOUT) cat $(PROFOUT) +.PHONY: compile_commands.json compile_commands.json: rm -f $(BINDIR)/compile_commands.json $(MAKE) config=$(config) clean bear $(MAKE) config=$(config) mv compile_commands.json $(BINDIR) +.PHONY: install +install: install-inc install-lib + $(LIBTOOL) --mode=finish '$(DESTDIR)$(LIBDIR)' + +.PHONY: install-inc +install-inc: $(AMALG_H) mpack.pc.in + mkdir -p '$(DESTDIR)$(INCDIR)' + install -m644 $(AMALG_H) '$(DESTDIR)$(INCDIR)' + mkdir -p '$(DESTDIR)$(LIBDIR)/pkgconfig' + sed 's,@VERSION@,$(VERSION),;s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR),' <mpack.pc.in >'$(DESTDIR)$(LIBDIR)/pkgconfig/mpack.pc' + +.PHONY: install-lib +install-lib: $(LIB) + mkdir -p '$(DESTDIR)$(LIBDIR)' + $(LIBTOOL) --mode=install cp $(LIB) '$(DESTDIR)$(LIBDIR)/$(LIBRARY)' + +.PHONY: clean +clean: + rm -rf $(BINDIR)/$(config) + +$(TOBJ): XCFLAGS := $(filter-out $(TEST_FILTER_OUT),$(XCFLAGS)) \ + -std=gnu99 -Wno-conversion -Wno-unused-parameter + $(COVOUT): $(SRC) $(TSRC) find $(OUTDIR) -type f -name '*.gcda' -print0 | xargs -0 rm -f $(MAKE) CFLAGS='-DNDEBUG -g --coverage' LDFLAGS=--coverage config=$(config) test @@ -107,16 +142,15 @@ gprof $(OUTDIR)/run-tests gmon.out > $@ rm gmon.out -clean: - rm -rf $(BINDIR)/$(config) - $(OUTDIR)/%.lo: %.c $(AMALG) @echo compile $< =\> $@ @$(LIBTOOL) --mode=compile --tag=CC $(CC) $(XCFLAGS) $(CFLAGS) -o $@ -c $< $(LIB): $(OBJ) @echo link $^ =\> $@ - @$(LIBTOOL) --mode=link --tag=CC $(CC) $(XLDFLAGS) $(LDFLAGS) -o $@ $^ + @$(LIBTOOL) --mode=link --tag=CC $(CC) $(XLDFLAGS) $(LDFLAGS) \ + -rpath '$(LIBDIR)' \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -o $@ $^ $(TEXE): $(LIB) $(TOBJ) @echo link $^ =\> $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/binding/lua/Makefile new/libmpack-1.0.3/binding/lua/Makefile --- old/libmpack-1.0.2/binding/lua/Makefile 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/binding/lua/Makefile 2016-09-18 22:09:16.000000000 +0200 @@ -1,7 +1,11 @@ # makefile to setup environment for travis and development +# distributors probably want to set this to 'yes' for both make and make install +USE_SYSTEM_LUA ?= no + # Lua-related configuration -LUA_VERSION ?= 5.1.5 +LUA_VERSION_MAJ_MIN ?= 5.1 +LUA_VERSION ?= $(LUA_VERSION_MAJ_MIN).5 LUA_VERSION_NOPATCH = $(shell echo -n $(LUA_VERSION) | sed 's!\([0-9]\.[0-9]\).[0-9]!\1!') LUA_URL ?= https://github.com/lua/lua/releases/download/$(LUA_VERSION)/lua-$(LUA_VERSION).tar.gz LUAROCKS_URL ?= https://github.com/keplerproject/luarocks/archive/v2.2.0.tar.gz @@ -16,13 +20,26 @@ LUA ?= $(DEPS_BIN)/lua LUAROCKS ?= $(DEPS_BIN)/luarocks BUSTED ?= $(DEPS_BIN)/busted +ifeq ($(USE_SYSTEM_LUA),no) MPACK ?= $(DEPS_PREFIX)/lib/lua/$(LUA_VERSION_NOPATCH)/mpack.so +else +MPACK ?= mpack.so +endif # Compilation CC ?= gcc -CFLAGS := -ansi -O0 -g3 -fPIC -Wall -Wextra -Werror -Wconversion \ - -Wstrict-prototypes -Wno-unused-parameter -pedantic \ - -DMPACK_DEBUG_REGISTRY_LEAK +PKG_CONFIG ?= pkg-config +CFLAGS ?= -ansi -O0 -g3 -Wall -Wextra -Werror -Wconversion \ + -Wstrict-prototypes -Wno-unused-parameter -pedantic +CFLAGS += -fPIC -DMPACK_DEBUG_REGISTRY_LEAK + +LUA_INCLUDE := $(shell $(PKG_CONFIG) --cflags lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-I/usr/include/lua$(LUA_VERSION_MAJ_MIN)") +LUA_LIB := $(shell $(PKG_CONFIG) --libs lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-llua$(LUA_VERSION_MAJ_MIN)") +INCLUDES = $(LUA_INCLUDE) +LIBS = $(LUA_LIB) + +LUA_CMOD_INSTALLDIR := $(shell $(PKG_CONFIG) --variable=INSTALL_CMOD lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "/usr/lib/lua/$(LUA_VERSION_MAJ_MIN)") + # Misc # Options used by the 'valgrind' target, which runs the tests under valgrind @@ -46,18 +63,32 @@ valgrind: $(BUSTED) $(MPACK) eval $$($(LUAROCKS) path); \ valgrind $(VALGRIND_OPTS) $(LUA) \ - $(DEPS_PREFIX)/lib/luarocks/rocks/busted/2.0.rc11-0/bin/busted test.lua + $(DEPS_PREFIX)/lib/luarocks/rocks/busted/2.0.rc12-1/bin/busted test.lua gdb: $(BUSTED) $(MPACK) eval $$($(LUAROCKS) path); \ gdb -x .gdb --args $(LUA) \ - $(DEPS_PREFIX)/lib/luarocks/rocks/busted/2.0.rc11-0/bin/busted test.lua + $(DEPS_PREFIX)/lib/luarocks/rocks/busted/2.0.rc12-1/bin/busted test.lua +ifeq ($(USE_SYSTEM_LUA),no) $(MPACK): $(LUAROCKS) lmpack.c $(LUAROCKS) make CFLAGS='$(CFLAGS)' +else +$(MPACK): lmpack.c + $(CC) -shared $(CFLAGS) $(INCLUDES) $(LDFLAGS) $^ -o $@ $(LIBS) +endif $(BUSTED): $(LUAROCKS) - $(LUAROCKS) install busted + $(LUAROCKS) install penlight 1.3.2-2 + $(LUAROCKS) install lua-term 0.7-1 + $(LUAROCKS) install dkjson 2.5-2 + $(LUAROCKS) install lua_cliargs 3.0-1 + $(LUAROCKS) install say 1.3-1 + $(LUAROCKS) install luafilesystem 1.6.3-2 + $(LUAROCKS) install luassert 1.7.10-0 + $(LUAROCKS) install mediator_lua 1.1.2-0 + $(LUAROCKS) install luasystem 0.2.0-0 + $(LUAROCKS) install busted 2.0.rc12-1 $(LUAROCKS) install inspect # helpful for debugging $(LUAROCKS): $(LUA) @@ -74,4 +105,12 @@ sed -i -e '/^CFLAGS/s/-O2/-g3/' src/Makefile && \ make $(LUA_TARGET) install INSTALL_TOP=$(DEPS_PREFIX) -.PHONY: all depsclean test gdb valgrind +install: $(MPACK) +ifeq ($(USE_SYSTEM_LUA),no) + @: +else + mkdir -p "$(DESTDIR)$(LUA_CMOD_INSTALLDIR)" + install -Dm755 $< "$(DESTDIR)$(LUA_CMOD_INSTALLDIR)/$<" +endif + +.PHONY: all depsclean install test gdb valgrind diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/binding/lua/lmpack.c new/libmpack-1.0.3/binding/lua/lmpack.c --- old/libmpack-1.0.2/binding/lua/lmpack.c 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/binding/lua/lmpack.c 2016-09-18 22:09:16.000000000 +0200 @@ -29,6 +29,12 @@ #define SESSION_META_NAME "mpack.Session" #define NIL_NAME "mpack.Nil" +#if LUA_VERSION_NUM > 501 +typedef luaL_Reg luaL_reg; +#define luaL_register(L, name, lreg) (luaL_setfuncs((L), (lreg), 0)) +#define lua_objlen(L, idx) (lua_rawlen(L, (idx))) +#endif + typedef struct { lua_State *L; mpack_parser_t *parser; @@ -414,7 +420,7 @@ { int result, argc; lua_Number startpos; - size_t len; + size_t len, offset; const char *str, *str_init; Unpacker *unpacker; @@ -433,7 +439,9 @@ luaL_argcheck(L, (size_t)startpos <= len, 3, "start position must be less than or equal to the input string length"); - str += (size_t)startpos - 1; + offset = (size_t)startpos - 1 ; + str += offset; + len -= offset; result = lmpack_unpacker_unpack_str(L, unpacker, &str, &len); if (result == MPACK_EOF) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/binding/lua/mpack-1.0.2-0.rockspec new/libmpack-1.0.3/binding/lua/mpack-1.0.2-0.rockspec --- old/libmpack-1.0.2/binding/lua/mpack-1.0.2-0.rockspec 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/binding/lua/mpack-1.0.2-0.rockspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,22 +0,0 @@ -local git_tag = '1.0.2' - -package = 'mpack' -version = git_tag .. '-0' -source = { - url = 'https://github.com/tarruda/libmpack/archive/' .. git_tag .. '.tar.gz', - dir = 'libmpack-' .. git_tag .. '/binding/lua', -} - -description = { - summary = 'Lua binding to libmpack', - license = 'MIT' -} - -build = { - type = 'builtin', - modules = { - ['mpack'] = { - sources = {'lmpack.c'} - } - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/binding/lua/mpack-1.0.3-0.rockspec new/libmpack-1.0.3/binding/lua/mpack-1.0.3-0.rockspec --- old/libmpack-1.0.2/binding/lua/mpack-1.0.3-0.rockspec 1970-01-01 01:00:00.000000000 +0100 +++ new/libmpack-1.0.3/binding/lua/mpack-1.0.3-0.rockspec 2016-09-18 22:09:16.000000000 +0200 @@ -0,0 +1,22 @@ +local git_tag = '1.0.3' + +package = 'mpack' +version = git_tag .. '-0' +source = { + url = 'https://github.com/tarruda/libmpack/archive/' .. git_tag .. '.tar.gz', + dir = 'libmpack-' .. git_tag .. '/binding/lua', +} + +description = { + summary = 'Lua binding to libmpack', + license = 'MIT' +} + +build = { + type = 'builtin', + modules = { + ['mpack'] = { + sources = {'lmpack.c'} + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/mpack.pc.in new/libmpack-1.0.3/mpack.pc.in --- old/libmpack-1.0.2/mpack.pc.in 1970-01-01 01:00:00.000000000 +0100 +++ new/libmpack-1.0.3/mpack.pc.in 2016-09-18 22:09:16.000000000 +0200 @@ -0,0 +1,9 @@ +libdir=@LIBDIR@ +includedir=@INCDIR@ +version=@VERSION@ + +Name: mpack +Description: small binary serialization library implementing msgpack and msgpack-rpc formats +Version: ${version} +Libs: -L${libdir} -lmpack +Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/src/core.h new/libmpack-1.0.3/src/core.h --- old/libmpack-1.0.2/src/core.h 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/src/core.h 2016-09-18 22:09:16.000000000 +0200 @@ -76,6 +76,8 @@ mpack_uint32_t passthrough; } mpack_tokbuf_t; +#define MPACK_TOKBUF_INITIAL_VALUE { { 0 }, { 0, 0, { { 0, 0 } } }, 0, 0, 0 } + MPACK_API void mpack_tokbuf_init(mpack_tokbuf_t *tb) FUNUSED FNONULL; MPACK_API int mpack_read(mpack_tokbuf_t *tb, const char **b, size_t *bl, mpack_token_t *tok) FUNUSED FNONULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/src/object.c new/libmpack-1.0.3/src/object.c --- old/libmpack-1.0.2/src/object.c 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/src/object.c 2016-09-18 22:09:16.000000000 +0200 @@ -13,6 +13,7 @@ parser->data.p = NULL; parser->capacity = capacity ? capacity : MPACK_MAX_OBJECT_DEPTH; parser->size = 0; + parser->exiting = 0; memset(parser->items, 0, sizeof(mpack_node_t) * (parser->capacity + 1)); parser->items[0].pos = (size_t)-1; parser->status = 0; @@ -22,10 +23,15 @@ do { \ mpack_node_t *n; \ \ + if (parser->exiting) goto exit; \ if (mpack_parser_full(parser)) return MPACK_NOMEM; \ n = mpack_parser_push(parser); \ action; \ + parser->exiting = 1; \ + return MPACK_EOF; \ \ +exit: \ + parser->exiting = 0; \ while ((n = mpack_parser_pop(parser))) { \ exit_cb(parser, n); \ if (!parser->size) return MPACK_OK; \ @@ -57,14 +63,17 @@ const char *buf_save = *buf; size_t buflen_save = *buflen; - if ((status = mpack_read(tb, buf, buflen, &tok)) == MPACK_OK) { + if ((status = mpack_read(tb, buf, buflen, &tok)) != MPACK_OK) continue; + + do { status = mpack_parse_tok(parser, tok, enter_cb, exit_cb); - if (status == MPACK_NOMEM) { - /* restore buf/buflen so the next call will read the same token */ - *buf = buf_save; - *buflen = buflen_save; - break; - } + } while (parser->exiting); + + if (status == MPACK_NOMEM) { + /* restore buf/buflen so the next call will read the same token */ + *buf = buf_save; + *buflen = buflen_save; + break; } } @@ -89,8 +98,10 @@ if (status == MPACK_NOMEM) break; - write_status = mpack_write(tb, buf, buflen, &tok); - status = write_status ? write_status : status; + if (parser->exiting) { + write_status = mpack_write(tb, buf, buflen, &tok); + status = write_status ? write_status : status; + } } return status; @@ -102,7 +113,7 @@ mpack_uint32_t dst_capacity = dst->capacity; assert(src->capacity <= dst_capacity); /* copy all fields except the stack */ - memcpy(dst, src, sizeof(MPACK_PARSER_STRUCT(0)) - sizeof(mpack_node_t)); + memcpy(dst, src, sizeof(mpack_one_parser_t) - sizeof(mpack_node_t)); /* reset capacity */ dst->capacity = dst_capacity; /* copy the stack */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/src/object.h new/libmpack-1.0.3/src/object.h --- old/libmpack-1.0.2/src/object.h 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/src/object.h 2016-09-18 22:09:16.000000000 +0200 @@ -40,13 +40,18 @@ mpack_data_t data; \ mpack_uint32_t size, capacity; \ int status; \ + int exiting; \ mpack_tokbuf_t tokbuf; \ mpack_node_t items[c + 1]; \ } +/* Some compilers warn against anonymous structs: + * https://github.com/tarruda/libmpack/issues/6 */ +typedef MPACK_PARSER_STRUCT(0) mpack_one_parser_t; + #define MPACK_PARSER_STRUCT_SIZE(c) \ (sizeof(mpack_node_t) * c + \ - sizeof(MPACK_PARSER_STRUCT(0))) + sizeof(mpack_one_parser_t)) typedef MPACK_PARSER_STRUCT(MPACK_MAX_OBJECT_DEPTH) mpack_parser_t; typedef void(*mpack_walk_cb)(mpack_parser_t *w, mpack_node_t *n); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/src/rpc.c new/libmpack-1.0.3/src/rpc.c --- old/libmpack-1.0.2/src/rpc.c 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/src/rpc.c 2016-09-18 22:09:16.000000000 +0200 @@ -242,7 +242,7 @@ mpack_uint32_t dst_capacity = dst->capacity; assert(src->capacity <= dst_capacity); /* copy all fields except slots */ - memcpy(dst, src, sizeof(MPACK_RPC_SESSION_STRUCT(1)) - + memcpy(dst, src, sizeof(mpack_rpc_one_session_t) - sizeof(struct mpack_rpc_slot_s)); /* reset capacity */ dst->capacity = dst_capacity; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/src/rpc.h new/libmpack-1.0.3/src/rpc.h --- old/libmpack-1.0.2/src/rpc.h 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/src/rpc.h 2016-09-18 22:09:16.000000000 +0200 @@ -46,9 +46,13 @@ struct mpack_rpc_slot_s slots[c]; \ } +/* Some compilers warn against anonymous structs: + * https://github.com/tarruda/libmpack/issues/6 */ +typedef MPACK_RPC_SESSION_STRUCT(1) mpack_rpc_one_session_t; + #define MPACK_RPC_SESSION_STRUCT_SIZE(c) \ (sizeof(struct mpack_rpc_slot_s) * (c - 1) + \ - sizeof(MPACK_RPC_SESSION_STRUCT(1))) + sizeof(mpack_rpc_one_session_t)) typedef MPACK_RPC_SESSION_STRUCT(MPACK_RPC_MAX_REQUESTS) mpack_rpc_session_t; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/test/deps/tap/tap.c new/libmpack-1.0.3/test/deps/tap/tap.c --- old/libmpack-1.0.2/test/deps/tap/tap.c 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/test/deps/tap/tap.c 2016-09-18 22:09:16.000000000 +0200 @@ -1,7 +1,7 @@ /* libtap - Write tests in C Copyright 2012 Jake Gelbman <gelb...@gmail.com> -This file is licensed under the GPLv2 or any later version +This file is licensed under the LGPL */ #define _DEFAULT_SOURCE 1 @@ -46,7 +46,7 @@ why = vstrdupf(fmt, args); va_end(args); printf("1..0 "); - note("SKIP %s\n", why); + diag("SKIP %s\n", why); exit(0); } if (tests != NO_PLAN) { @@ -59,8 +59,9 @@ va_list args) { char *name = vstrdupf(fmt, args); - if (!test) + if (!test) { printf("not "); + } printf("ok %d", ++current_test); if (*name) printf(" - %s", name); @@ -71,13 +72,13 @@ } printf("\n"); if (!test) { - fprintf(stderr, "# Failed "); + printf("# Failed "); if (todo_mesg) - fprintf(stderr, "(TODO) "); - fprintf(stderr, "test "); + printf("(TODO) "); + printf("test "); if (*name) - fprintf(stderr, "'%s'\n# ", name); - fprintf(stderr, "at %s line %d.\n", file, line); + printf("'%s'\n# ", name); + printf("at %s line %d.\n", file, line); if (!todo_mesg) failed_tests++; } @@ -207,19 +208,21 @@ return !diff; } -static void -vdiag_to_fh (FILE *fh, const char *fmt, va_list args) { +int +diag (const char *fmt, ...) { + va_list args; char *mesg, *line; int i; + va_start(args, fmt); if (!fmt) - return; + return 0; mesg = vstrdupf(fmt, args); line = mesg; for (i = 0; *line; i++) { char c = mesg[i]; if (!c || c == '\n') { mesg[i] = '\0'; - fprintf(fh, "# %s\n", line); + printf("# %s\n", line); if (!c) break; mesg[i] = c; @@ -227,23 +230,6 @@ } } free(mesg); - return; -} - -int -diag (const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vdiag_to_fh(stderr, fmt, args); - va_end(args); - return 0; -} - -int -note (const char *fmt, ...) { - va_list args; - va_start(args, fmt); - vdiag_to_fh(stdout, fmt, args); va_end(args); return 0; } @@ -257,15 +243,12 @@ else if (current_test != expected_tests) { diag("Looks like you planned %d test%s but ran %d.", expected_tests, expected_tests > 1 ? "s" : "", current_test); - retval = 255; + retval = 2; } if (failed_tests) { diag("Looks like you failed %d test%s of %d run.", failed_tests, failed_tests > 1 ? "s" : "", current_test); - if (expected_tests == NO_PLAN) - retval = failed_tests; - else - retval = expected_tests - current_test + failed_tests; + retval = 1; } return retval; } @@ -291,7 +274,7 @@ va_end(args); while (n --> 0) { printf("ok %d ", ++current_test); - note("skip %s\n", why); + diag("skip %s\n", why); } free(why); } @@ -369,4 +352,3 @@ return test; } #endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/test/deps/tap/tap.h new/libmpack-1.0.3/test/deps/tap/tap.h --- old/libmpack-1.0.2/test/deps/tap/tap.h 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/test/deps/tap/tap.h 2016-09-18 22:09:16.000000000 +0200 @@ -1,7 +1,7 @@ /* libtap - Write tests in C Copyright 2012 Jake Gelbman <gelb...@gmail.com> -This file is licensed under the GPLv2 or any later version +This file is licensed under the LGPL */ #ifndef __TAP_H__ @@ -38,7 +38,6 @@ int bail_out (int ignore, const char *fmt, ...); void tap_plan (int tests, const char *fmt, ...); int diag (const char *fmt, ...); -int note (const char *fmt, ...); int exit_status (void); void tap_skip (int n, const char *fmt, ...); void tap_todo (int ignore, const char *fmt, ...); @@ -46,7 +45,7 @@ #define NO_PLAN -1 #define SKIP_ALL -2 -#define ok(...) ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL) +#define ok(...) ok_at_loc(__FILE__, __LINE__, (int) __VA_ARGS__, NULL) #define is(...) is_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL) #define isnt(...) isnt_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL) #define cmp_ok(...) cmp_ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL) @@ -114,4 +113,3 @@ #endif #endif - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmpack-1.0.2/test/mpack.c new/libmpack-1.0.3/test/mpack.c --- old/libmpack-1.0.2/test/mpack.c 2016-04-09 03:33:18.000000000 +0200 +++ new/libmpack-1.0.3/test/mpack.c 2016-09-18 22:09:16.000000000 +0200 @@ -339,8 +339,7 @@ char mpackbuf[256]; char *buf = mpackbuf; size_t buflen = sizeof(mpackbuf); - mpack_tokbuf_t writer; - mpack_tokbuf_init(&writer); + mpack_tokbuf_t writer = MPACK_TOKBUF_INITIAL_VALUE; tokbuf[tokbufpos++] = mpack_pack_sint(0); tokbuf[tokbufpos++] = mpack_pack_sint(1); tokbuf[tokbufpos++] = mpack_pack_sint(0x7f);