Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a9d7b9

Browse files
author
Martin Smith
committed
free commonAttributes
1 parent58fc1b8 commit9a9d7b9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎Array.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
voidfreeArray(Array*array)
3434
{
35+
if(array->hasCommonAttributes) {
36+
free(array->commonAttributes);
37+
}
3538
free(array->arrayTable);
3639
free(array);
3740
}

‎Array.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@
3333

3434
#include<stdlib.h>
3535
#include<stdint.h>
36+
#include<stdbool.h>
3637

3738
typedefstruct
3839
{
3940
void*arrayTable;
4041
void*commonAttributes;
42+
boolhasCommonAttributes;
4143
uint32_tlength;
4244
}Array;
4345

@@ -53,7 +55,10 @@ Array *FUNCNAME (const Array *array)
5355
if( array->commonAttributes ) \
5456
{ \
5557
result->commonAttributes = CALLOC(1, sizeof(TYPEATTR)); \
58+
result->hasCommonAttributes = 1; \
5659
memcpy(result->commonAttributes, array->commonAttributes, sizeof(TYPEATTR)); \
60+
} else { \
61+
result->hasCommonAttributes = 0; \
5762
} \
5863
return result; \
5964
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp