aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_cfg_file.c2
-rw-r--r--src/lua/lua_classifier.c2
-rw-r--r--src/lua/lua_common.h2
-rw-r--r--src/lua/lua_config.c4
-rw-r--r--src/lua/lua_rcl.c21
5 files changed, 16 insertions, 15 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 6fe773987..9e636ecef 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -140,7 +140,7 @@ lua_post_load_config (struct config_file *cfg)
if (name != NULL && lua_istable (L, -1)) {
obj = lua_rcl_obj_get (L, -1);
if (obj != NULL) {
- cfg->rcl_obj = ucl_object_insert_key_merged (cfg->rcl_obj, obj, name, keylen, true);
+ ucl_object_insert_key_merged (cfg->rcl_obj, obj, name, keylen, true);
}
}
}
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c
index be574319a..82e7ea2b7 100644
--- a/src/lua/lua_classifier.c
+++ b/src/lua/lua_classifier.c
@@ -382,7 +382,7 @@ lua_statfile_get_param (lua_State *L)
{
struct statfile *st = lua_check_statfile (L);
const gchar *param;
- ucl_object_t *value;
+ const ucl_object_t *value;
param = luaL_checkstring (L, 2);
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index cdce7b3d3..d03ca168e 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -114,7 +114,7 @@ void free_lua_locked (struct lua_locked_state *st);
* @param L lua state
* @param obj object to push
*/
-gint lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array);
+gint lua_rcl_obj_push (lua_State *L, const ucl_object_t *obj, gboolean allow_array);
/**
* Extract rcl object from lua object
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 7987fa00e..acf3ae3be 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -156,7 +156,7 @@ lua_config_get_module_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
const gchar *mname, *optname;
- ucl_object_t *obj;
+ const ucl_object_t *obj;
if (cfg) {
mname = luaL_checkstring (L, 2);
@@ -192,7 +192,7 @@ lua_config_get_all_opt (lua_State * L)
{
struct config_file *cfg = lua_check_config (L);
const gchar *mname;
- ucl_object_t *obj;
+ const ucl_object_t *obj;
if (cfg) {
mname = luaL_checkstring (L, 2);
diff --git a/src/lua/lua_rcl.c b/src/lua/lua_rcl.c
index 2768ac4a4..efedc0725 100644
--- a/src/lua/lua_rcl.c
+++ b/src/lua/lua_rcl.c
@@ -27,8 +27,8 @@
* @file lua rcl bindings
*/
-static gint lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj);
-static gint lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array);
+static gint lua_rcl_obj_push_array (lua_State *L, const ucl_object_t *obj);
+static gint lua_rcl_obj_push_simple (lua_State *L, const ucl_object_t *obj, gboolean allow_array);
static ucl_object_t* lua_rcl_table_get (lua_State *L, gint idx);
static ucl_object_t* lua_rcl_elt_get (lua_State *L, gint idx);
@@ -39,7 +39,7 @@ static ucl_object_t* lua_rcl_elt_get (lua_State *L, gint idx);
* @param obj
*/
static void
-lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj)
+lua_rcl_obj_push_elt (lua_State *L, const char *key, const ucl_object_t *obj)
{
lua_pushstring (L, key);
lua_rcl_obj_push (L, obj, TRUE);
@@ -53,9 +53,9 @@ lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj)
* @return
*/
static gint
-lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push_obj (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
- ucl_object_t *cur;
+ const ucl_object_t *cur;
ucl_object_iter_t it = NULL;
if (allow_array && obj->next != NULL) {
@@ -78,9 +78,9 @@ lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array)
* @return
*/
static gint
-lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj)
+lua_rcl_obj_push_array (lua_State *L, const ucl_object_t *obj)
{
- ucl_object_t *cur;
+ const ucl_object_t *cur;
gint i = 1;
lua_newtable (L);
@@ -98,7 +98,7 @@ lua_rcl_obj_push_array (lua_State *L, ucl_object_t *obj)
* Push a simple object to lua depending on its actual type
*/
static gint
-lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push_simple (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
if (allow_array && obj->next != NULL) {
/* Actually we need to push this as an array */
@@ -137,7 +137,7 @@ lua_rcl_obj_push_simple (lua_State *L, ucl_object_t *obj, gboolean allow_array)
* @param obj object to push
*/
gint
-lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array)
+lua_rcl_obj_push (lua_State *L, const ucl_object_t *obj, gboolean allow_array)
{
switch (obj->type) {
case UCL_OBJECT:
@@ -165,12 +165,13 @@ lua_rcl_table_get (lua_State *L, gint idx)
/* Table iterate */
lua_pushvalue (L, idx);
lua_pushnil (L);
+ top = ucl_object_typed_new (UCL_OBJECT);
while (lua_next (L, -2) != 0) {
/* copy key to avoid modifications */
lua_pushvalue (L, -2);
k = lua_tolstring (L, -1, &keylen);
obj = lua_rcl_elt_get (L, -2);
- top = ucl_object_insert_key (top, obj, k, keylen, true);
+ ucl_object_insert_key (top, obj, k, keylen, true);
lua_pop (L, 2);
}
lua_pop (L, 1);