[PATCH 03/15] <net-snmp/library/snmp_api.h>: Add missing #include directives

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
Make sure that the struct timeval definition is included when it is
used inside this header file.
---
 include/net-snmp/library/snmp_api.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/net-snmp/library/snmp_api.h b/include/net-snmp/library/snmp_api.h
index 6cde26958bb5..a7d62e36a486 100644
--- a/include/net-snmp/library/snmp_api.h
+++ b/include/net-snmp/library/snmp_api.h
@@ -37,6 +37,21 @@
 
 #include <net-snmp/net-snmp-features.h>
 
+#ifdef SNMP_NEED_REQUEST_LIST
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h> /* struct timeval */
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#else
+struct timeval;
+#endif
+
 #ifndef DONT_SHARE_ERROR_WITH_OTHER_THREADS
 #define SET_SNMP_ERROR(x) snmp_errno=(x)
 #else
@@ -70,7 +85,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 SOFTWARE.
 ******************************************************************/
 
-struct timeval;
 /*
  * A list of all the outstanding requests for a particular session.
  */
-- 
2.16.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.