* [PATCH] libxl{,u}: replace TOSTRING()
@ 2025-04-07 11:29 Jan Beulich
2025-04-07 12:32 ` Anthony PERARD
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2025-04-07 11:29 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Juergen Gross
Now that common-macros.h has STR() available, which is even slightly
more flexible, use that and drop the custom macros.
No difference in generated code (except for line numbers, of course,
where embedded in code/data).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -53,7 +53,7 @@ static void disk_eject_xswatch_callback(
}
sscanf(backend,
- "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE)
+ "/local/domain/%d/backend/%" STR(BACKEND_STRING_SIZE)
"[a-z]/%*d/%*d",
&disk->backend_domid, backend_type);
if (!strcmp(backend_type, "tap") ||
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2093,9 +2093,6 @@ _hidden int libxl__init_recursive_mutex(
_hidden int libxl__gettimeofday(libxl__gc *gc, struct timeval *now_r);
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-
/* from libxl_qmp */
typedef struct libxl__qmp_handler libxl__qmp_handler;
--- a/tools/libs/util/libxlu_disk_l.c
+++ b/tools/libs/util/libxlu_disk_l.c
@@ -1152,7 +1152,7 @@ void xlu__disk_yyset_column(int column_
#define DSET(dpc,member,enumname,str,valname) do{ \
if (dpc->disk->member != LIBXL_DISK_##enumname##_UNKNOWN && \
dpc->disk->member != LIBXL_DISK_##enumname##_##valname) { \
- xlu__disk_err(dpc, str, TOSTRING(member) " respecified"); \
+ xlu__disk_err(dpc, str, STR(member) " respecified"); \
} else { \
dpc->disk->member = LIBXL_DISK_##enumname##_##valname; \
} \
--- a/tools/libs/util/libxlu_disk_l.l
+++ b/tools/libs/util/libxlu_disk_l.l
@@ -64,7 +64,7 @@ void xlu__disk_yyset_column(int column_
#define DSET(dpc,member,enumname,str,valname) do{ \
if (dpc->disk->member != LIBXL_DISK_##enumname##_UNKNOWN && \
dpc->disk->member != LIBXL_DISK_##enumname##_##valname) { \
- xlu__disk_err(dpc, str, TOSTRING(member) " respecified"); \
+ xlu__disk_err(dpc, str, STR(member) " respecified"); \
} else { \
dpc->disk->member = LIBXL_DISK_##enumname##_##valname; \
} \
--- a/tools/libs/util/libxlu_internal.h
+++ b/tools/libs/util/libxlu_internal.h
@@ -25,6 +25,8 @@
#include "libxlutil.h"
+#include <xen-tools/common-macros.h>
+
struct XLU_ConfigList {
int avalues; /* available slots */
int nvalues; /* actual occupied slots */
@@ -69,10 +71,6 @@ typedef struct {
void *scanner;
} CfgParseContext;
-
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-
#endif /*LIBXLU_INTERNAL_H*/
/*
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libxl{,u}: replace TOSTRING()
2025-04-07 11:29 [PATCH] libxl{,u}: replace TOSTRING() Jan Beulich
@ 2025-04-07 12:32 ` Anthony PERARD
0 siblings, 0 replies; 2+ messages in thread
From: Anthony PERARD @ 2025-04-07 12:32 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Juergen Gross
On Mon, Apr 07, 2025 at 01:29:29PM +0200, Jan Beulich wrote:
> Now that common-macros.h has STR() available, which is even slightly
> more flexible, use that and drop the custom macros.
>
> No difference in generated code (except for line numbers, of course,
> where embedded in code/data).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-07 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 11:29 [PATCH] libxl{,u}: replace TOSTRING() Jan Beulich
2025-04-07 12:32 ` Anthony PERARD
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.