"Daniel P. Berrange" <berrange(a)redhat.com> wrote:
...
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
...
+#define ADD_ENV_SPACE
\
+ do { \
+ if (qenvc == qenva) { \
+ qenva += 10; \
+ if (VIR_REALLOC_N(qenv, qenva) < 0) \
+ goto no_memory; \
+ } \
+ } while (0)
...
+#define ADD_ENV_COPY(envname)
\
+ do { \
+ char *val = getenv(envname); \
+ char *envval; \
+ ADD_ENV_SPACE; \
+ if (val != NULL) { \
+ if (asprintf(&envval, "%s=%s", envname, val) < 0)
\
+ goto no_memory; \
+ qenv[qenvc++] = envval; \
+ } \
+ } while (0)
All looks good.
You might as well move the ADD_ENV_SPACE down into the "if" block.