about summary refs log tree commit diff
path: root/cli/stat.c
diff options
context:
space:
mode:
authorMarq Schneider <queueRAM@gmail.com>2010-08-13 10:55:14 -0500
committerMarq Schneider <queueRAM@gmail.com>2010-08-13 10:55:14 -0500
commita6328070d92c75396c941a6962f4553ee7f3f9c1 (patch)
tree4eae52c83f16f9b82632c894a4e4916cc772ba0d /cli/stat.c
parent9667cf0694245ead296a4d79a1579448a625fd60 (diff)
downloadbtpd-a6328070d92c75396c941a6962f4553ee7f3f9c1.tar.gz
btpd-a6328070d92c75396c941a6962f4553ee7f3f9c1.zip
Added ARRAY_COUNT() macro to get number of elements in const arrays.
Diffstat (limited to 'cli/stat.c')
-rw-r--r--cli/stat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cli/stat.c b/cli/stat.c
index b4ad898..bb7a6a4 100644
--- a/cli/stat.c
+++ b/cli/stat.c
@@ -1,4 +1,5 @@
 #include "btcli.h"
+#include "utils.h"
 
 void
 usage_stat(void)
@@ -56,7 +57,7 @@ static enum ipc_tval stkeys[] = {
     IPC_TVAL_CSIZE
 };
 
-static size_t nstkeys = sizeof(stkeys) / sizeof(stkeys[0]);
+#define NSTKEYS ARRAY_COUNT(stkeys)
 
 static void
 print_stat(struct btstat *st)
@@ -129,10 +130,10 @@ again:
     bzero(&cba.tot, sizeof(cba.tot));
     cba.tot.state = IPC_TSTATE_INACTIVE;
     if (tps == NULL)
-        err = btpd_tget_wc(ipc, IPC_TWC_ACTIVE, stkeys, nstkeys,
+        err = btpd_tget_wc(ipc, IPC_TWC_ACTIVE, stkeys, NSTKEYS,
             stat_cb, &cba);
     else
-        err = btpd_tget(ipc, tps, ntps, stkeys, nstkeys, stat_cb, &cba);
+        err = btpd_tget(ipc, tps, ntps, stkeys, NSTKEYS, stat_cb, &cba);
     if (err != IPC_OK)
         diemsg("command failed (%s).\n", ipc_strerror(err));
     if (names)