X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=daemon%2Fdaemon.h;h=489c38d4bd6636199bb2d641eef2b1c91ec639b1;hb=ec730ce979f1d19b21ba1000ad6fe811b62df394;hp=6ed68fd8dd7b54d639cad398544def7b52390f39;hpb=400b2cb03d5f7e606707d01ef278438c4b8440dc;p=libguestfs.git diff --git a/daemon/daemon.h b/daemon/daemon.h index 6ed68fd..489c38d 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -212,6 +212,18 @@ is_zero (const char *buffer, size_t size) return 1; } +/* Helper for building up short lists of arguments. Your code has to + * define MAX_ARGS to a suitable value. + */ +#define ADD_ARG(argv,i,v) \ + do { \ + if ((i) >= MAX_ARGS) { \ + fprintf (stderr, "%s: %d: internal error: exceeded MAX_ARGS (%zu) when constructing the command line\n", __FILE__, __LINE__, (size_t) MAX_ARGS); \ + abort (); \ + } \ + (argv)[(i)++] = (v); \ + } while (0) + /* Helper for functions that need a root filesystem mounted. * NB. Cannot be used for FileIn functions. */