[Tarantool-patches] [PATCH 2.X 6/7] module api: luaL_checkibuf & luaL_checkconstchar
Timur Safin
tsafin at tarantool.org
Thu Sep 24 20:00:19 MSK 2020
Moved `luaL_checkibuf` & `luaL_checkconstchar` to the public
part of module api.
Part of #5273
---
src/exports.h | 2 ++
src/lua/utils.h | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/exports.h b/src/exports.h
index ef4f3b741..08c7ac53f 100644
--- a/src/exports.h
+++ b/src/exports.h
@@ -348,6 +348,8 @@ EXPORT(luaL_callmeta)
EXPORT(luaL_cdef)
EXPORT(luaL_checkany)
EXPORT(luaL_checkcdata)
+EXPORT(luaL_checkconstchar)
+EXPORT(luaL_checkibuf)
EXPORT(luaL_checkint64)
EXPORT(luaL_checkinteger)
EXPORT(luaL_checklstring)
diff --git a/src/lua/utils.h b/src/lua/utils.h
index da0140076..6b10d2755 100644
--- a/src/lua/utils.h
+++ b/src/lua/utils.h
@@ -589,6 +589,23 @@ luaT_temp_luastate(int *coro_ref, int *top);
void
luaT_release_temp_luastate(struct lua_State *L, int coro_ref, int top);
+/**
+ * Check if a value on @a L stack by index @a idx is an ibuf
+ * object. Both 'struct ibuf' and 'struct ibuf *' are accepted.
+ * Returns NULL, if can't convert - not an ibuf object.
+ */
+struct ibuf *
+luaL_checkibuf(struct lua_State *L, int idx);
+
+/**
+ * Check if a value on @a L stack by index @a idx is pointer at
+ * char or const char. '(char *)NULL' is also considered a valid
+ * char pointer.
+ */
+int
+luaL_checkconstchar(struct lua_State *L, int idx, const char **res,
+ uint32_t *cdata_type_p);
+
/** \endcond public */
/**
@@ -666,6 +683,8 @@ luaL_checkfinite(struct lua_State *L, struct luaL_serializer *cfg,
luaL_error(L, "number must not be NaN or Inf");
}
+/** \cond public */
+
/**
* Check if a value on @a L stack by index @a idx is an ibuf
* object. Both 'struct ibuf' and 'struct ibuf *' are accepted.
--
2.20.1
More information about the Tarantool-patches
mailing list