40 #define ASN_MEM_BLOCK 0x100 54 static fpa1_syntaxBlock *current_blk = NULL;
55 static fpa1_syntaxBlock *first_block = NULL;
72 if (current_blk->count == ASN_MEM_BLOCK)
74 if (current_blk->next == NULL)
76 fpa1_syntaxBlock *new_block;
77 new_block = (fpa1_syntaxBlock *) pa1_malloc(
sizeof(fpa1_syntaxBlock));
78 if (new_block != NULL)
80 memset( new_block, 0,
sizeof(fpa1_syntaxBlock));
81 current_blk->next = new_block;
82 TRACE(TMEMORY, (
"new_blk=%p", new_block))
89 current_blk = current_blk->next;
93 newItem = &(current_blk->items[current_blk->count]);
96 newItem->data.intData = 0;
97 newItem->dataType = 0;
110 fpa1_syntaxBlock *temp_block;
112 temp_block = first_block;
114 while (temp_block != current_blk)
116 TRACE(TMEMORY, (
"temp_blk=%p, cnt=%d, chk=%d", temp_block, temp_block->count, temp_block->check))
117 for (i = 0; i != ASN_MEM_BLOCK; i++)
119 if (temp_block->items[i].data.stringData.data != NULL)
121 STR_DataFree( temp_block->items[i].data.stringData.data,
122 temp_block->items[i].data.stringData.len );
123 temp_block->items[i].data.stringData.data = NULL;
124 temp_block->items[i].data.stringData.len = 0;
127 temp_block->count = 0;
128 temp_block->check = 0;
129 temp_block = temp_block->next;
132 for (i = 0; i != temp_block->count; i++)
134 if (temp_block->items[i].data.stringData.data != NULL)
136 STR_DataFree( temp_block->items[i].data.stringData.data,
137 temp_block->items[i].data.stringData.len );
138 temp_block->items[i].data.stringData.data = NULL;
139 temp_block->items[i].data.stringData.len = 0;
142 TRACE(TMEMORY, (
"temp_blk=%p, cnt=%d, chk=%d", temp_block, temp_block->count, temp_block->check))
143 temp_block->count = 0;
144 temp_block->check = 0;
145 current_blk = temp_block;
146 temp_block = temp_block->next;
147 while (temp_block != NULL)
149 if (temp_block->check != 8)
151 TRACE(TMEMORY, (
"temp_blk=%p chk=%d", temp_block, temp_block->check))
153 current_blk = temp_block;
154 temp_block = temp_block->next;
158 TRACE(TMEMORY, (
"free blk=%p", temp_block))
159 if (current_blk->next == temp_block)
161 current_blk->next = NULL;
163 current_blk = temp_block->next;
164 pa1_free(temp_block);
165 temp_block = current_blk;
168 current_blk = first_block;
183 if (nextComp != NULL)
186 if (firstComp->children != NULL)
189 firstComp->children = NULL;
193 nextComp = nextComp->next;
198 firstComp->next = NULL;
212 while (firstComp != NULL)
220 int ASN1_MemInit(
void)
222 assert( first_block == NULL );
223 first_block = (fpa1_syntaxBlock *) pa1_malloc(
sizeof(fpa1_syntaxBlock));
224 if (first_block != NULL)
226 memset( first_block, 0,
sizeof(fpa1_syntaxBlock));
228 current_blk = first_block;
229 TRACE(TMEMORY, (
"first_blk=%p", first_block))
230 return (first_block == NULL) ? 0 : 1;
233 void ASN1_MemExit(
void)
235 fpa1_syntaxBlock *temp_block;
236 temp_block = first_block;
237 while (temp_block != NULL)
239 current_blk = temp_block->next;
240 pa1_free(temp_block);
241 temp_block = current_blk;
fpa1_syntaxList * fpa1_getTagItem(void)
int fpa1_delList(fpa1_syntaxList *firstComp)
fpa1_syntaxList * fpa1_delFirstItem(fpa1_syntaxList *firstComp)
fpa1_syntaxList * fpa1_synFreeFirstItem(fpa1_syntaxList *)
Contains functions/structure used to do MHEG-5 ASN.1 syntax parsing.
Typedefs, macros used by all of parser. These may be duplicated elsewhere.
Contains macros for MHEG-5 ASN.1 tags and structures.
int fpa1_freeUnusedData(void)
syntax item block manager Contains functions to create a mini memory manager for allocating syntax li...
Mheg5 logging and debug printing.
Contains memory management functions.