mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lua: Use guestfs___free_string_list instead of custom-coded version.
This commit is contained in:
@@ -53,6 +53,7 @@ let generate_lua_c () =
|
||||
#endif
|
||||
|
||||
#include <guestfs.h>
|
||||
#include \"guestfs-internal-frontend.h\"
|
||||
|
||||
#define GUESTFS_LUA_HANDLE \"guestfs handle\"
|
||||
|
||||
@@ -96,8 +97,6 @@ static uint64_t get_event (lua_State *L, int index);
|
||||
static uint64_t get_event_bitmask (lua_State *L, int index);
|
||||
static void push_event (lua_State *L, uint64_t event);
|
||||
|
||||
static void free_strings (char **r);
|
||||
|
||||
";
|
||||
|
||||
List.iter (
|
||||
@@ -608,10 +607,10 @@ guestfs_lua_delete_event_callback (lua_State *L)
|
||||
pr " free (r);\n"
|
||||
| RStringList _ ->
|
||||
pr " push_string_list (L, r);\n";
|
||||
pr " free_strings (r);\n"
|
||||
pr " guestfs___free_string_list (r);\n"
|
||||
| RHashtable _ ->
|
||||
pr " push_table (L, r);\n";
|
||||
pr " free_strings (r);\n"
|
||||
pr " guestfs___free_string_list (r);\n"
|
||||
| RStruct (_, typ) ->
|
||||
pr " push_%s (L, r);\n" typ;
|
||||
pr " guestfs_free_%s (r);\n" typ
|
||||
@@ -869,16 +868,6 @@ push_event (lua_State *L, uint64_t event)
|
||||
) (rstructs_used_by external_functions);
|
||||
|
||||
pr "\
|
||||
void
|
||||
free_strings (char **r)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; r[i] != NULL; ++i)
|
||||
free (r[i]);
|
||||
free (r);
|
||||
}
|
||||
|
||||
/* Metamethods.
|
||||
* See: http://article.gmane.org/gmane.comp.lang.lua.general/95065
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,12 @@ libluaguestfs_la_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
$(LUA_CFLAGS)
|
||||
|
||||
libluaguestfs_la_LIBADD = $(top_builddir)/src/libguestfs.la
|
||||
libluaguestfs_la_LIBADD = \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
||||
libluaguestfs_la_LDFLAGS = -avoid-version -shared
|
||||
|
||||
|
||||
Reference in New Issue
Block a user