forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c4d53b
commit e6c362c
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "../../common.h" | ||
#include "../../mcontext.h" | ||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
typedef struct { | ||
IHeader h; | ||
uint16_t i; | ||
} HH; | ||
|
||
IHeader *MakeOne(void) | ||
{ | ||
static int s = 0; | ||
|
||
static HH h; | ||
|
||
h.h.HashValue = s++; | ||
|
||
h.i = s++; | ||
|
||
return (IHeader *)&h; | ||
} | ||
|
||
int main(void) | ||
{ | ||
HH a, b; | ||
|
||
ModuleContext c; | ||
|
||
ModuleContext_Init(&c); | ||
|
||
a = *(HH *)MakeOne(); | ||
|
||
c.Add(&c, (IHeader *)&a); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
c.Add(&c, MakeOne()); | ||
|
||
c.FindAndRemove(&c, (IHeader *)&a, (IHeader *)&b); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<CodeBlocks_project_file> | ||
<FileVersion major="1" minor="6" /> | ||
<Project> | ||
<Option title="mcontext" /> | ||
<Option pch_mode="2" /> | ||
<Option compiler="gcc" /> | ||
<Build> | ||
<Target title="Debug"> | ||
<Option output="bin/Debug/mcontext" prefix_auto="1" extension_auto="1" /> | ||
<Option object_output="obj/Debug/" /> | ||
<Option type="1" /> | ||
<Option compiler="gcc" /> | ||
<Compiler> | ||
<Add option="-g" /> | ||
</Compiler> | ||
</Target> | ||
<Target title="Release"> | ||
<Option output="bin/Release/mcontext" prefix_auto="1" extension_auto="1" /> | ||
<Option object_output="obj/Release/" /> | ||
<Option type="1" /> | ||
<Option compiler="gcc" /> | ||
<Compiler> | ||
<Add option="-O2" /> | ||
</Compiler> | ||
<Linker> | ||
<Add option="-s" /> | ||
</Linker> | ||
</Target> | ||
</Build> | ||
<Compiler> | ||
<Add option="-Wall" /> | ||
</Compiler> | ||
<Unit filename="../../array.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../array.h" /> | ||
<Unit filename="../../bst.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../bst.h" /> | ||
<Unit filename="../../common.h" /> | ||
<Unit filename="../../dnsparser.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../dnsparser.h" /> | ||
<Unit filename="../../iheader.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../iheader.h" /> | ||
<Unit filename="../../mcontext.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../mcontext.h" /> | ||
<Unit filename="../../utils.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Unit filename="../../utils.h" /> | ||
<Unit filename="main.c"> | ||
<Option compilerVar="CC" /> | ||
</Unit> | ||
<Extensions> | ||
<envvars /> | ||
<code_completion /> | ||
<debugger /> | ||
</Extensions> | ||
</Project> | ||
</CodeBlocks_project_file> |