include the correct standard headers
authorBrian Norris <banorris@uci.edu>
Tue, 11 Dec 2012 19:11:45 +0000 (11:11 -0800)
committerBrian Norris <banorris@uci.edu>
Tue, 11 Dec 2012 19:38:42 +0000 (11:38 -0800)
Our own headers are including several of the wrong headers in the wrong
places. Move a few to place them more closely to their actual usage
location, and remove some others that are unused (e.g., <iostream>,
<cassert>, <csignal>).

mymemory.cc
mymemory.h
snapshot-interface.cc
snapshot.cc
snapshotimp.h

index 6ea6b92927c4ddebabe5b690b13800667a70fd08..e05cb783e2455bdf68aaa5b495fa664e000677f2 100644 (file)
@@ -1,12 +1,17 @@
-#include "mymemory.h"
-#include "snapshot.h"
-#include "snapshotimp.h"
+#include <stdlib.h>
 #include <stdio.h>
 #include <dlfcn.h>
 #include <unistd.h>
-#include <cstring>
+#include <string.h>
+#include <new>
+
+#include "mymemory.h"
+#include "snapshot.h"
+#include "snapshotimp.h"
 #include "common.h"
+
 #define REQUESTS_BEFORE_ALLOC 1024
+
 size_t allocatedReqs[ REQUESTS_BEFORE_ALLOC ] = { 0 };
 int nextRequest = 0;
 int howManyFreed = 0;
@@ -193,7 +198,7 @@ void * calloc(size_t num, size_t size)
                return tmp;
        } else {
                void *tmp = HandleEarlyAllocationRequest(size * num);
-               std::memset(tmp, 0, size * num);
+               memset(tmp, 0, size * num);
                return tmp;
        }
 }
index 794c4e50cd1e1198ff6d9d8b86ba373114495e10..f2a31865ba85a9272794514de14e3179bb2da01e 100644 (file)
@@ -4,8 +4,8 @@
 
 #ifndef _MY_MEMORY_H
 #define _MY_MEMORY_H
-#include <stdlib.h>
 #include <limits>
+#include <stddef.h>
 
 #include "config.h"
 
index 51fe2f08de1392dd6fe40cd3757edcf675367c60..c8afa8f9465483ab169c644d3b8cec5c86b08a21 100644 (file)
@@ -1,15 +1,10 @@
-#include "snapshot-interface.h"
-#include "snapshot.h"
-#include <iostream>
-#include <fstream>
+#include <stdlib.h>
 #include <unistd.h>
-#include <sstream>
 #include <cstring>
-#include <string>
-#include <cassert>
-#include <vector>
-#include <utility>
 #include <inttypes.h>
+
+#include "snapshot-interface.h"
+#include "snapshot.h"
 #include "common.h"
 
 /* MYBINARYNAME only works because our pathname usually includes 'model' (e.g.,
index e930a33622ce9dbb89463cd77b0447f84de7f45c..8bc685c57c146f6bd7767b2476e9d74f6b963ea5 100644 (file)
@@ -3,20 +3,15 @@
 #include <unistd.h>
 #include <signal.h>
 #include <stdlib.h>
-#include "hashtable.h"
-#include <cstring>
-#include <cstdio>
-#include "snapshot.h"
-#include "snapshotimp.h"
-#include "mymemory.h"
-#include <fcntl.h>
-#include <assert.h>
-#include <pthread.h>
-#include <semaphore.h>
+#include <string.h>
 #include <errno.h>
 #include <sys/wait.h>
 #include <ucontext.h>
 
+#include "hashtable.h"
+#include "snapshot.h"
+#include "snapshotimp.h"
+#include "mymemory.h"
 #include "common.h"
 
 #define FAILURE(mesg) { model_print("failed in the API: %s with errno relative message: %s\n", mesg, strerror( errno ) ); exit(EXIT_FAILURE); }
index b03d28527e3efe69257cbf48ac1311776dbec5ee..0560203f1dc8e358312d9b3cfc30040e4a6fb225 100644 (file)
@@ -2,14 +2,13 @@
  *     @brief Snapshotting implementation header file..
  */
 
-#ifndef _SNAPSHOTIMP_H
-#define _SNAPSHOTIMP_H
+#ifndef __SNAPSHOTIMP_H__
+#define __SNAPSHOTIMP_H__
+
+#include <stddef.h>
+
 #include "snapshot.h"
-#include <iostream>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <csignal>
+
 #define SHARED_MEMORY_DEFAULT  (100 * ((size_t)1 << 20)) // 100mb for the shared memory
 #define STACK_SIZE_DEFAULT      (((size_t)1 << 20) * 20)  // 20 mb out of the above 100 mb for my stack
 
@@ -53,6 +52,9 @@ struct SnapShot {
 };
 
 #else
+
+#include <ucontext.h>
+
 struct SnapShot {
        void *mSharedMemoryBase;
        void *mStackBase;
@@ -65,4 +67,5 @@ struct SnapShot {
 
 //Global reference to snapshot data structure
 extern struct SnapShot * snapshotrecord;
-#endif
+
+#endif /* __SNAPSHOTIMP_H__ */