Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
In the middle of a change. Committing for safety.
Signed-off-by: saad0105050 <saad0105050@gmail.com>
- Loading branch information
saad0105050
committed
Oct 1, 2014
1 parent
ec27b6b
commit 3471efd
Showing
5 changed files
with
118 additions
and
33 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
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 |
---|---|---|
@@ -1,33 +1,11 @@ | ||
/**/ | ||
#include "common.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define MAXSEG 5 | ||
#define DYNARR_TYPE int | ||
#define TYPED_NAME( name ) TOKEN_PASTE(DYNARR_TYPE, name) | ||
#include "dynarr.h" | ||
typedef struct TYPED_NAME(DynArr) IdArr; | ||
|
||
|
||
#define DYNARR_TYPE float | ||
#define TYPED_NAME( name ) TOKEN_PASTE(DYNARR_TYPE, name) | ||
#include "dynarr.h" | ||
typedef struct TYPED_NAME(DynArr) ValueArr; | ||
|
||
|
||
int main(int argc, char** argv){ | ||
MEM_LEAK_CATCH(); | ||
|
||
IdArr *p1; | ||
ValueArr *p2; | ||
|
||
p1 = (IdArr*)malloc(sizeof(IdArr)); | ||
p2 = (ValueArr*)malloc(sizeof(ValueArr)); | ||
|
||
|
||
// done | ||
FREE_SAFE(p1); | ||
FREE_SAFE(p2); | ||
MEM_LEAK_SHOW(); | ||
return 0; | ||
} | ||
#define EXTERN | ||
|
||
/* Some global variables used externally */ | ||
/* Maximum number of segments allowed to be in the system. Must be a power of 2 */ | ||
EXTERN unsigned int MaxSeg; | ||
/* Base-2 log */ | ||
EXTERN unsigned int LogMaxSeg; | ||
/* MAXSEG-1; MAXSEG must be a power of 2 */ | ||
EXTERN unsigned int MaxSegRemainderBitMask; |
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
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,11 @@ | ||
#ifndef __dynarr_free_node_list_h__ | ||
#define __dynarr_free_node_list_h__ | ||
|
||
// the struct FreeSegNode will be used multiple times, so we do not want to redefine it | ||
struct FreeSegNode{ | ||
int index; | ||
struct FreeSegNode* next; | ||
}; | ||
typedef struct FreeSegNode FreeSegNode; | ||
|
||
#endif |
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,33 @@ | ||
#include "common.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define MAXSEG 5 | ||
#define DYNARR_TYPE int | ||
#define TYPED_NAME( name ) TOKEN_PASTE(DYNARR_TYPE, name) | ||
#include "dynarr.h" | ||
typedef struct TYPED_NAME(DynArr) IdArr; | ||
|
||
|
||
#define DYNARR_TYPE float | ||
#define TYPED_NAME( name ) TOKEN_PASTE(DYNARR_TYPE, name) | ||
#include "dynarr.h" | ||
typedef struct TYPED_NAME(DynArr) ValueArr; | ||
|
||
|
||
int main(int argc, char** argv){ | ||
MEM_LEAK_CATCH(); | ||
|
||
IdArr *p1; | ||
ValueArr *p2; | ||
|
||
p1 = (IdArr*)malloc(sizeof(IdArr)); | ||
p2 = (ValueArr*)malloc(sizeof(ValueArr)); | ||
|
||
|
||
// done | ||
FREE_SAFE(p1); | ||
FREE_SAFE(p2); | ||
MEM_LEAK_SHOW(); | ||
return 0; | ||
} |