snapshot: move declarations to the right interface header
authorBrian Norris <banorris@uci.edu>
Wed, 30 May 2012 06:35:15 +0000 (23:35 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 30 May 2012 06:35:15 +0000 (23:35 -0700)
We should have a minimal set of code/declarations in the snapshot-interface.h
header. And it should not include other headers unless necessary. With this
change, the model checker code only needs to use snapshot-interface.h.

main.cc
snapshot-interface.h
snapshot.h

diff --git a/main.cc b/main.cc
index 958a4451594569b3e77d72e942ba200ad52891b3..e8a2b3317dc4ebedc235735fef32d272259d4215 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -4,7 +4,6 @@
 
 /* global "model" object */
 #include "model.h"
-#include "snapshot.h"
 #include "snapshot-interface.h"
 
 /*
index 9a2b9cc18e3b3eaaa4e18434078126d2dbb1ccf6..e9746e1ebb35468ff20e0ea68fd9ee364a0e7cd6 100644 (file)
@@ -1,8 +1,13 @@
 #ifndef __SNAPINTERFACE_H
 #define __SNAPINTERFACE_H
-#include "snapshot.h"
 #include "mymemory.h"
-#include "snapshot.h"
+
+typedef unsigned int snapshot_id;
+
+typedef void (*VoidFuncPtr)();
+void initSnapShotLibrary(unsigned int numbackingpages,
+               unsigned int numsnapshots, unsigned int nummemoryregions,
+               unsigned int numheappages, VoidFuncPtr entryPoint);
 
 void SnapshotGlobalSegments();
 
index af0130f43f83333cba7cab0307ed16eb6caba82e..39e294a8c60f1c0d781fdafb43a6162b6475f1af 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef _SNAPSHOT_H
 #define _SNAPSHOT_H
+
+#include "snapshot-interface.h"
+
 #define PAGESIZE 4096
 
 /* If USE_MPROTECT_SNAPSHOT=1, then snapshot by using mmap() and mprotect()
@@ -9,13 +12,6 @@
 /* Size of signal stack */
 #define SIGSTACKSIZE 16384
 
-typedef unsigned int snapshot_id;
-
-typedef void (*VoidFuncPtr)();
-void initSnapShotLibrary(unsigned int numbackingpages,
-               unsigned int numsnapshots, unsigned int nummemoryregions,
-               unsigned int numheappages, VoidFuncPtr entryPoint);
-
 void addMemoryRegionToSnapShot( void * ptr, unsigned int numPages );
 
 snapshot_id takeSnapshot( );