[Pcsclite-cvs-commit] r6758 - trunk/PCSC/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Oct 1 12:55:58 UTC 2013


Author: rousseau
Date: 2013-10-01 12:55:58 +0000 (Tue, 01 Oct 2013)
New Revision: 6758

Modified:
   trunk/PCSC/src/misc.h
Log:
Add COUNT_OF macro

This macro returns the number of elements in an array.

See http://stackoverflow.com/questions/1598773


Modified: trunk/PCSC/src/misc.h
===================================================================
--- trunk/PCSC/src/misc.h	2013-09-30 13:35:22 UTC (rev 6757)
+++ trunk/PCSC/src/misc.h	2013-10-01 12:55:58 UTC (rev 6758)
@@ -55,4 +55,8 @@
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 #endif
 
+#ifndef COUNT_OF
+#define COUNT_OF(arr) (sizeof(arr)/sizeof(arr[0]))
+#endif
+
 #endif /* __misc_h__ */




More information about the Pcsclite-cvs-commit mailing list