summaryrefslogtreecommitdiffstats
path: root/exim_monitor/em_xs.c
blob: ee91f7c159c06ff85e4754c6f6670fbc98e92590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*************************************************
*               Exim Monitor                     *
*************************************************/

/* Copyright (c) University of Cambridge, 1995 - 2016 */
/* See the file NOTICE for conditions of use and distribution. */

/* This file contains a number of subroutines that are in effect
just alternative packaging for calls to various X functions that
happen to be convenient for this program. */

#include "em_hdr.h"



/*************************************************
*                  xs_SetValues                  *
*************************************************/

/* Unpick a variable-length argument list and set up an
appropriate call to XtSetValues. To make it reasonably
efficient, we keep a working Arg structure of length 15;
the largest call in eximon sets 11 values. The code uses
malloc/free if more, just in case there is ever a longer
one that gets overlooked. */

static Arg xs_temparg[15];

void xs_SetValues(Widget w, Cardinal num_args, ...)
{
int i;
va_list ap;
Arg *aa = (num_args > 15)? store_malloc(num_args*sizeof(Arg)) : xs_temparg;
va_start(ap, num_args);
for (i = 0; i < num_args; i++)
  {
  aa[i].name = va_arg(ap, String);
  aa[i].value = va_arg(ap, XtArgVal);
  }
va_end(ap);
XtSetValues(w, aa, num_args);
if (num_args > 15) store_free(aa);
}

/* End of em_xs.c */