Убрал утечку памяти
This commit is contained in:
parent
5a6972e698
commit
7e7ec0e12c
3 changed files with 13 additions and 22 deletions
|
@ -64,6 +64,8 @@ void repairPolygon(polygon * plgn) {
|
|||
delLine(&lns, i--);
|
||||
}
|
||||
}
|
||||
|
||||
free(lns.arr);
|
||||
}
|
||||
|
||||
bool isNull(point vector) {
|
||||
|
@ -82,19 +84,6 @@ DELFUNC(Vector, points)
|
|||
|
||||
DELFUNC(Line, lines)
|
||||
|
||||
//void delVector(points * vectors, int index) {
|
||||
// DEL(vectors -> arr, index, vectors -> len)
|
||||
// vectors -> len--;
|
||||
//}
|
||||
//
|
||||
//void delLine(lines * lns, int index) {
|
||||
// for (int i = index + 1; i < lns -> len; ++i) {
|
||||
// lns -> arr[i] = lns -> arr[i - 1];
|
||||
// }
|
||||
//
|
||||
// lns -> len--;
|
||||
//}
|
||||
|
||||
polygon getPolygon(polygon * plgn, double shift) {
|
||||
points vectors = getVectors(plgn -> pts);
|
||||
int secind, len = plgn -> pts.len;
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
#include <math.h>
|
||||
#include "types.h"
|
||||
|
||||
#define DELFUNC(NAME, TYPE) \
|
||||
void del##NAME(TYPE * array, int index) { \
|
||||
DEL(array->arr, index, array->len) \
|
||||
array -> len--; \
|
||||
}
|
||||
|
||||
#define DEL(DATA, INDEX, LEN) \
|
||||
for (int i = INDEX; i < (LEN) - 1; ++i) { \
|
||||
(DATA)[i] = (DATA)[i + 1]; \
|
||||
}
|
||||
|
||||
line getLine(point pt1, point pt2);
|
||||
lines getLines(points pts);
|
||||
points getVectors(points pts);
|
||||
|
|
|
@ -9,16 +9,7 @@
|
|||
int len;\
|
||||
} NAME
|
||||
|
||||
#define DELFUNC(NAME, TYPE) \
|
||||
void del##NAME(TYPE * array, int index) { \
|
||||
DEL(array->arr, index, array->len) \
|
||||
array -> len--; \
|
||||
}
|
||||
|
||||
#define DEL(DATA, INDEX, LEN) \
|
||||
for (int i = INDEX; i < (LEN) - 1; ++i) { \
|
||||
(DATA)[i] = (DATA)[i + 1]; \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
double x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue