[Tarantool-patches] [PATCH 1/4] lua: move serializer helpers into its own file
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sun Jul 4 16:10:00 MSK 2021
Thanks for the patch!
See 3 comments below.
> diff --git a/src/lua/init.c b/src/lua/init.c
> index 93e93a103..ff11d202b 100644
> --- a/src/lua/init.c
> +++ b/src/lua/init.c
> @@ -69,6 +69,10 @@
> #include <readline/readline.h>
> #include <readline/history.h>
>
> +/* Don't include the entire header only for *_init(). */
1. But what is the problem with that? It would be simpler and
consistent with the other inits.
> diff --git a/src/lua/serializer.c b/src/lua/serializer.c
> new file mode 100644
> index 000000000..6c3dd73af
> --- /dev/null
> +++ b/src/lua/serializer.c
> @@ -0,0 +1,651 @@
> +/*
> + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file.
> + *
> + * Redistribution and use in source and binary forms, with or
> + * without modification, are permitted provided that the following
> + * conditions are met:
> + *
> + * 1. Redistributions of source code must retain the above
> + * copyright notice, this list of conditions and the
> + * following disclaimer.
> + *
> + * 2. Redistributions in binary form must reproduce the above
> + * copyright notice, this list of conditions and the following
> + * disclaimer in the documentation and/or other materials
> + * provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
> + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
> + * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
> + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +#include <assert.h>
> +#include <stdbool.h>
> +#include <math.h> /* modf, isfinite */
> +#include <lua.h>
> +#include <lauxlib.h>
2. These are already included in the header. And some of the others
below too.
> diff --git a/src/lua/serializer.h b/src/lua/serializer.h
> new file mode 100644
> index 000000000..54b0bc11a
> --- /dev/null
> +++ b/src/lua/serializer.h
> @@ -0,0 +1,344 @@
> +#ifndef TARANTOOL_LUA_SERIALIZER_H_INCLUDED
> +#define TARANTOOL_LUA_SERIALIZER_H_INCLUDED
3. According to the code style, new files should use `#pragma once`.
More information about the Tarantool-patches
mailing list