Files
xen/tools/libs
Jason Andryuk 47268fb8c8 tools/libxl: Make gentypes.py compatible with older Python
removeprefix is only added in Python 3.9.

Instead of the prefix removal, switch to passing in a "depth" parameter,
and incrementing it for each level.

There is a slight change in the generated _libxl_types.c.  instances of
KeyedUnion increment depth without outputing any code.  The net result
is some cases where jso_sub_1 is followed by jso_sub_3.  As an example:

  _libxl_types.c
  _libxl_types.c
  @@ -5535,12 +5535,12 @@
                   if (!jso_sub_1)
                       goto out;
                   if (!libxl__string_is_default(&p->u.pty.path)) {
  -                    json_object *jso_sub_2 = NULL;
  -                    rc = libxl__string_gen_jso(&jso_sub_2, p->u.pty.path);
  +                    json_object *jso_sub_3 = NULL;
  +                    rc = libxl__string_gen_jso(&jso_sub_3, p->u.pty.path);
                       if (rc)
                           goto out;
  -                    if (json_object_object_add(jso_sub_1, "path", jso_sub_2)) {
  -                        json_object_put(jso_sub_2);
  +                    if (json_object_object_add(jso_sub_1, "path", jso_sub_3)) {
  +                        json_object_put(jso_sub_3);
                           goto out;
                       }
                   }

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2025-10-21 18:11:22 +01:00
..
2025-04-08 09:39:50 +02:00