#include "openwsman.h"
#include "virstring.h"
#include "virkeycode.h"
-#include "intprops.h"
#define VIR_FROM_THIS VIR_FROM_HYPERV
Msvm_Keyboard *keyboard = NULL;
virBuffer query = VIR_BUFFER_INITIALIZER;
hypervInvokeParamsListPtr params = NULL;
- char keycodeStr[INT_BUFSIZE_BOUND(int)];
+ char keycodeStr[VIR_INT64_STR_BUFLEN];
virCheckFlags(0, -1);
#include "virfile.h"
#include "vircommand.h"
#include "configmake.h"
-#include "intprops.h"
#include "virstring.h"
#include "virfirewall.h"
bool directionIn,
bool *skipRule, bool *skipMatch)
{
- char ipaddr[INET6_ADDRSTRLEN],
- ipaddralt[INET6_ADDRSTRLEN],
- number[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))];
+ char ipaddr[INET6_ADDRSTRLEN];
+ char ipaddralt[INET6_ADDRSTRLEN];
+ char number[VIR_INT64_STR_BUFLEN];
const char *src = "--source";
const char *dst = "--destination";
const char *srcrange = "--src-range";
ipHdrDataDefPtr ipHdr,
bool directionIn)
{
- char number[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))];
+ char number[VIR_INT64_STR_BUFLEN];
char str[MAX_IPSET_NAME_LENGTH];
if (HAS_ENTRY_ITEM(&ipHdr->dataIPSet) &&
bool maySkipICMP)
{
char chain[MAX_CHAINNAME_LENGTH];
- char number[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))];
- char numberalt[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))];
+ char number[VIR_INT64_STR_BUFLEN];
+ char numberalt[VIR_INT64_STR_BUFLEN];
const char *target;
bool srcMacSkipped = false;
bool skipRule = false;
virNWFilterVarCombIterPtr vars,
bool reverse)
{
- char macaddr[VIR_MAC_STRING_BUFLEN],
- ipaddr[INET_ADDRSTRLEN],
- ipmask[INET_ADDRSTRLEN],
- ipv6addr[INET6_ADDRSTRLEN],
- number[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))],
- numberalt[MAX(INT_BUFSIZE_BOUND(uint32_t),
- INT_BUFSIZE_BOUND(int))],
- field[MAX(VIR_MAC_STRING_BUFLEN, INET6_ADDRSTRLEN)],
- fieldalt[MAX(VIR_MAC_STRING_BUFLEN, INET6_ADDRSTRLEN)];
+ char macaddr[VIR_MAC_STRING_BUFLEN];
+ char ipaddr[INET_ADDRSTRLEN];
+ char ipmask[INET_ADDRSTRLEN];
+ char ipv6addr[INET6_ADDRSTRLEN];
+ char number[VIR_INT64_STR_BUFLEN];
+ char numberalt[VIR_INT64_STR_BUFLEN];
+ char field[VIR_INT64_STR_BUFLEN];
+ char fieldalt[VIR_INT64_STR_BUFLEN];
char chain[MAX_CHAINNAME_LENGTH];
const char *target;
bool hasMask = false;
#include "internal.h"
-#include "intprops.h"
#include "virbuffer.h"
#include "viralloc.h"
#include "virlog.h"
VIR_LOG_INIT("nwfilter.nwfilter_learnipaddr");
-#define IFINDEX2STR(VARNAME, ifindex) \
- char VARNAME[INT_BUFSIZE_BOUND(ifindex)]; \
- g_snprintf(VARNAME, sizeof(VARNAME), "%d", ifindex);
-
#define PKT_TIMEOUT_MS 500 /* ms */
/* structure of an ARP request/reply message */
virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReqPtr req)
{
int res = -1;
- IFINDEX2STR(ifindex_str, req->ifindex);
+ g_autofree char *ifindex_str = g_strdup_printf("%d", req->ifindex);
virMutexLock(&pendingLearnReqLock);
int rc = -1;
int ifindex;
virNWFilterIPAddrLearnReqPtr req;
+ g_autofree char *ifindex_str = NULL;
/* It's possible that it's already been removed as a result of
* virNWFilterDeregisterLearnReq during learnIPAddressThread() exit
return rc;
}
- IFINDEX2STR(ifindex_str, ifindex);
+ ifindex_str = g_strdup_printf("%d", ifindex);
virMutexLock(&pendingLearnReqLock);
virNWFilterHasLearnReq(int ifindex)
{
void *res;
- IFINDEX2STR(ifindex_str, ifindex);
+ g_autofree char *ifindex_str = g_strdup_printf("%d", ifindex);
virMutexLock(&pendingLearnReqLock);
virNWFilterDeregisterLearnReq(int ifindex)
{
virNWFilterIPAddrLearnReqPtr res;
- IFINDEX2STR(ifindex_str, ifindex);
+ g_autofree char *ifindex_str = g_strdup_printf("%d", ifindex);
virMutexLock(&pendingLearnReqLock);
#endif
#include "configmake.h"
-#include "intprops.h"
#include "viralloc.h"
#include "vircommand.h"
#include "virerror.h"
if (!virFileExists(path))
return -2;
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(*value), &str) < 0)
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN, &str) < 0)
return -1;
virStringTrimOptionalNewline(str);
if (!virFileExists(path))
return -2;
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(*value), &str) < 0)
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN, &str) < 0)
return -1;
virStringTrimOptionalNewline(str);
if (!virFileExists(path))
return -2;
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(*value), &str) < 0)
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN, &str) < 0)
return -1;
virStringTrimOptionalNewline(str);
if (!virFileExists(path))
return -2;
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(*value), &str) < 0)
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN, &str) < 0)
return -1;
virStringTrimOptionalNewline(str);
#include "virhostcpupriv.h"
#include "physmem.h"
#include "virerror.h"
-#include "intprops.h"
#include "virarch.h"
#include "virfile.h"
#include "virtypedparam.h"
char line[1024];
unsigned long long usr, ni, sys, idle, iowait;
unsigned long long irq, softirq, steal, guest, guest_nice;
- char cpu_header[4 + INT_BUFSIZE_BOUND(cpuNum)];
+ char cpu_header[4 + VIR_INT64_STR_BUFLEN];
if ((*nparams) == 0) {
/* Current number of cpu stats supported by linux */
#include "virthread.h"
#include "virfile.h"
#include "virtime.h"
-#include "intprops.h"
#include "virstring.h"
#include "configmake.h"
# define IOVEC_SET_STRING(iov, str) IOVEC_SET(iov, str, strlen(str))
/* Used for conversion of numbers to strings, and for length of binary data */
-# define JOURNAL_BUF_SIZE (MAX(INT_BUFSIZE_BOUND(int), sizeof(uint64_t)))
+# define JOURNAL_BUF_SIZE (MAX(VIR_INT64_STR_BUFLEN, sizeof(uint64_t)))
struct journalState
{
#include "virfile.h"
#include "viralloc.h"
#include "virlog.h"
-#include "intprops.h"
#include "virstring.h"
#include <sys/ioctl.h>
path = g_strdup_printf(SYSFS_NET_DIR "%s/bridge/%s", brname, paramname);
if (virFileExists(path)) {
- char valuestr[INT_BUFSIZE_BOUND(value)];
- g_snprintf(valuestr, sizeof(valuestr), "%lu", value);
+ g_autofree char *valuestr = g_strdup_printf("%lu", value);
if (virFileWriteStr(path, valuestr, 0) >= 0)
return 0;
VIR_DEBUG("Unable to set bridge %s %s via sysfs", brname, paramname);
if (virFileExists(path)) {
g_autofree char *valuestr = NULL;
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(unsigned long),
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN,
&valuestr) < 0)
return -1;
const char *paramname,
unsigned long value)
{
- char valuestr[INT_BUFSIZE_BOUND(value)];
+ char valuestr[VIR_INT64_STR_BUFLEN];
int ret = -1;
g_autofree char *path = NULL;
path = g_strdup_printf(SYSFS_NET_DIR "%s/brif/%s/%s", brname, ifname,
paramname);
- if (virFileReadAll(path, INT_BUFSIZE_BOUND(unsigned long), &valuestr) < 0)
+ if (virFileReadAll(path, VIR_INT64_STR_BUFLEN, &valuestr) < 0)
return -1;
if (virStrToLong_ul(valuestr, NULL, 10, value) < 0) {
#include "virfile.h"
#include "viralloc.h"
#include "virutil.h"
-#include "intprops.h"
#include "virlog.h"
#include "virerror.h"
#include "virstring.h"
{
int rc;
int fd;
- char pidstr[INT_BUFSIZE_BOUND(pid)];
+ char pidstr[VIR_INT64_STR_BUFLEN];
if ((fd = open(pidfile,
O_WRONLY | O_CREAT | O_TRUNC,
int rc;
ssize_t bytes;
long long pid_value = 0;
- char pidstr[INT_BUFSIZE_BOUND(pid_value)];
+ char pidstr[VIR_INT64_STR_BUFLEN];
char *endptr = NULL;
*pid = 0;
pid_t pid)
{
int fd = -1;
- char pidstr[INT_BUFSIZE_BOUND(pid)];
+ char pidstr[VIR_INT64_STR_BUFLEN];
if (path[0] == '\0')
return 0;
#include "internal.h"
+#define VIR_INT64_STR_BUFLEN 21
+
char **virStringSplitCount(const char *string,
const char *delim,
size_t max_tokens,
# include "virlog.h"
# include "virmock.h"
# include "rpc/virnetsocket.h"
-# include "intprops.h"
# define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("tests.systemdtest");
size_t nsockIP;
int ret = -1;
size_t i;
- char nfdstr[INT_BUFSIZE_BOUND(size_t)];
- char pidstr[INT_BUFSIZE_BOUND(pid_t)];
+ char nfdstr[VIR_INT64_STR_BUFLEN];
+ char pidstr[VIR_INT64_STR_BUFLEN];
virSystemdActivationMap map[2];
int *fds = NULL;
size_t nfds = 0;
#include "internal.h"
#include "conf/virdomainobjlist.h"
-#include "intprops.h"
#include "viralloc.h"
#include "virmacaddr.h"
#include "virxml.h"
bool ret = false;
virshDomainListPtr list = NULL;
virDomainPtr dom;
- char id_buf[INT_BUFSIZE_BOUND(unsigned int)];
+ char id_buf[VIR_INT64_STR_BUFLEN];
unsigned int id;
unsigned int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
vshTablePtr table = NULL;
* so don't introduce a link time dep, which we must avoid
*/
#include "gnulib/lib/configmake.h"
-#include "gnulib/lib/intprops.h"
+
+#define VIR_INT64_STR_BUFLEN 21
int main(int argc, char **argv) {
- char uidstr[INT_BUFSIZE_BOUND(uid_t)];
- char gidstr[INT_BUFSIZE_BOUND(gid_t)];
+ char uidstr[VIR_INT64_STR_BUFLEN];
+ char gidstr[VIR_INT64_STR_BUFLEN];
const char * newargv[6];
size_t nargs = 0;
char *newenv[] = {