]> granicus.if.org Git - procps-ng/commitdiff
library: introduce pids 'value extractor' helper macro
authorJim Warner <james.warner@comcast.net>
Wed, 26 Aug 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 27 Aug 2015 12:22:01 +0000 (22:22 +1000)
As an experiment a helper macro used to extract values
from a result stack has been added to the header file.

Don't force callers to reinvent that particular wheel.

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.h

index 6c56780aa3e6b16b0d848af41e8aae74c1d00e1f..35e3d1b870f981bb3af7b0744d0cc60ee4320bb9 100644 (file)
@@ -190,6 +190,10 @@ struct pids_reap {
 };
 
 
+#define PROCPS_PIDS_VAL(rel_enum,type,stack) \
+    stack -> head [ rel_enum ] . result . type
+
+
 int procps_pids_new (
     struct procps_pidsinfo **info,
     int maxitems,