From f3f31f82a34dbd625942cbfe13528e91ff64ed4c Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 11 Dec 2012 11:11:45 -0800 Subject: [PATCH] include the correct standard headers 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., , , ). --- mymemory.cc | 15 ++++++++++----- mymemory.h | 2 +- snapshot-interface.cc | 13 ++++--------- snapshot.cc | 15 +++++---------- snapshotimp.h | 19 +++++++++++-------- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/mymemory.cc b/mymemory.cc index 6ea6b92..e05cb78 100644 --- a/mymemory.cc +++ b/mymemory.cc @@ -1,12 +1,17 @@ -#include "mymemory.h" -#include "snapshot.h" -#include "snapshotimp.h" +#include #include #include #include -#include +#include +#include + +#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; } } diff --git a/mymemory.h b/mymemory.h index 794c4e5..f2a3186 100644 --- a/mymemory.h +++ b/mymemory.h @@ -4,8 +4,8 @@ #ifndef _MY_MEMORY_H #define _MY_MEMORY_H -#include #include +#include #include "config.h" diff --git a/snapshot-interface.cc b/snapshot-interface.cc index 51fe2f0..c8afa8f 100644 --- a/snapshot-interface.cc +++ b/snapshot-interface.cc @@ -1,15 +1,10 @@ -#include "snapshot-interface.h" -#include "snapshot.h" -#include -#include +#include #include -#include #include -#include -#include -#include -#include #include + +#include "snapshot-interface.h" +#include "snapshot.h" #include "common.h" /* MYBINARYNAME only works because our pathname usually includes 'model' (e.g., diff --git a/snapshot.cc b/snapshot.cc index e930a33..8bc685c 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -3,20 +3,15 @@ #include #include #include -#include "hashtable.h" -#include -#include -#include "snapshot.h" -#include "snapshotimp.h" -#include "mymemory.h" -#include -#include -#include -#include +#include #include #include #include +#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); } diff --git a/snapshotimp.h b/snapshotimp.h index b03d285..0560203 100644 --- a/snapshotimp.h +++ b/snapshotimp.h @@ -2,14 +2,13 @@ * @brief Snapshotting implementation header file.. */ -#ifndef _SNAPSHOTIMP_H -#define _SNAPSHOTIMP_H +#ifndef __SNAPSHOTIMP_H__ +#define __SNAPSHOTIMP_H__ + +#include + #include "snapshot.h" -#include -#include -#include -#include -#include + #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 + 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__ */ -- 2.34.1