mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
erlang: Use guestfs___free_string_list from libutils, instead of custom version.
This commit is contained in:
@@ -55,7 +55,10 @@ erl_guestfs_LDADD = \
|
||||
$(ERLANG_LIB_DIR_erl_interface)/lib/liberl_interface.a \
|
||||
$(ERLANG_LIB_DIR_erl_interface)/lib/libei.a \
|
||||
-lpthread \
|
||||
$(top_builddir)/src/libutils.la \
|
||||
$(top_builddir)/src/libguestfs.la \
|
||||
$(LIBXML2_LIBS) \
|
||||
$(LIBVIRT_LIBS) \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* libguestfs Erlang bindings.
|
||||
* Copyright (C) 2011 Red Hat Inc.
|
||||
* Copyright (C) 2011-2013 Red Hat Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -52,7 +52,6 @@ extern char **get_string_list (ETERM *term);
|
||||
extern int get_bool (ETERM *term);
|
||||
extern int get_int (ETERM *term);
|
||||
extern int64_t get_int64 (ETERM *term);
|
||||
extern void free_strings (char **r);
|
||||
|
||||
/* This stops things getting out of hand, but also lets us detect
|
||||
* protocol problems quickly.
|
||||
@@ -314,13 +313,3 @@ get_int64 (ETERM *term)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free_strings (char **r)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; r[i] != NULL; ++i)
|
||||
free (r[i]);
|
||||
free (r);
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ instead of erl_interface.
|
||||
*/
|
||||
|
||||
#include \"guestfs.h\"
|
||||
#include \"guestfs-internal-frontend.h\"
|
||||
|
||||
extern guestfs_h *g;
|
||||
|
||||
@@ -214,7 +215,6 @@ extern char **get_string_list (ETERM *term);
|
||||
extern int get_bool (ETERM *term);
|
||||
extern int get_int (ETERM *term);
|
||||
extern int64_t get_int64 (ETERM *term);
|
||||
extern void free_strings (char **r);
|
||||
|
||||
#define ARG(i) (ERL_TUPLE_ELEMENT(message,(i)+1))
|
||||
|
||||
@@ -391,7 +391,7 @@ extern void free_strings (char **r);
|
||||
| OptString n | FileIn n | FileOut n | Key n ->
|
||||
pr " free (%s);\n" n
|
||||
| StringList n | DeviceList n ->
|
||||
pr " free_strings (%s);\n" n;
|
||||
pr " guestfs___free_string_list (%s);\n" n;
|
||||
| Bool _ | Int _ | Int64 _ | Pointer _ | BufferIn _ -> ()
|
||||
) args;
|
||||
List.iter (
|
||||
@@ -406,7 +406,7 @@ extern void free_strings (char **r);
|
||||
let uc_n = String.uppercase n in
|
||||
pr " if ((optargs_s.bitmask & %s_%s_BITMASK))\n"
|
||||
c_optarg_prefix uc_n;
|
||||
pr " free_strings ((char **) optargs_s.%s);\n" n
|
||||
pr " guestfs___free_string_list ((char **) optargs_s.%s);\n" n
|
||||
) optargs;
|
||||
|
||||
(match errcode_of_ret ret with
|
||||
@@ -439,7 +439,7 @@ extern void free_strings (char **r);
|
||||
pr " return rt;\n"
|
||||
| RStringList _ ->
|
||||
pr " ETERM *rt = make_string_list (r);\n";
|
||||
pr " free_strings (r);\n\n";
|
||||
pr " guestfs___free_string_list (r);\n\n";
|
||||
pr " return rt;\n"
|
||||
| RStruct (_, typ) ->
|
||||
pr " ETERM *rt = make_%s (r);\n" typ;
|
||||
@@ -451,7 +451,7 @@ extern void free_strings (char **r);
|
||||
pr " return rt;\n"
|
||||
| RHashtable _ ->
|
||||
pr " ETERM *rt = make_table (r);\n";
|
||||
pr " free_strings (r);\n";
|
||||
pr " guestfs___free_string_list (r);\n";
|
||||
pr " return rt;\n"
|
||||
| RBufferOut _ ->
|
||||
pr " ETERM *rt = erl_mk_estring (r, size);\n";
|
||||
|
||||
Reference in New Issue
Block a user