From e951c13e9172f5e3411d194f720c3b178147901a Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sun, 8 Mar 2015 11:15:31 +0100 Subject: [PATCH] elm_code line: move freeing to the line file --- legacy/elm_code/src/lib/elm_code_file.c | 9 ++------- legacy/elm_code/src/lib/elm_code_line.c | 12 ++++++++++++ legacy/elm_code/src/lib/elm_code_line.h | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/legacy/elm_code/src/lib/elm_code_file.c b/legacy/elm_code/src/lib/elm_code_file.c index d25bdd2895..269eddc4c6 100644 --- a/legacy/elm_code/src/lib/elm_code_file.c +++ b/legacy/elm_code/src/lib/elm_code_file.c @@ -136,9 +136,7 @@ EAPI void elm_code_file_free(Elm_Code_File *file) EINA_LIST_FREE(file->lines, l) { - if (l->modified) - free(l->modified); - free(l); + elm_code_line_free(l); } if (file->file) @@ -172,10 +170,7 @@ EAPI void elm_code_file_clear(Elm_Code_File *file) EINA_LIST_FREE(file->lines, l) { - if (l->modified) - free(l->modified); - - free(l); + elm_code_line_free(l); } if (file->parent) diff --git a/legacy/elm_code/src/lib/elm_code_line.c b/legacy/elm_code/src/lib/elm_code_line.c index e4fcfa41eb..bb8121c02c 100644 --- a/legacy/elm_code/src/lib/elm_code_line.c +++ b/legacy/elm_code/src/lib/elm_code_line.c @@ -6,6 +6,18 @@ #include "elm_code_private.h" +EAPI void +elm_code_line_free(Elm_Code_Line *line) +{ + if (!line) + return; + + if (line->modified) + free(line->modified); + + free(line); +} + EAPI unsigned int elm_code_line_utf8_length_get(Elm_Code_Line *line) { diff --git a/legacy/elm_code/src/lib/elm_code_line.h b/legacy/elm_code/src/lib/elm_code_line.h index b057c64809..af9663ba65 100644 --- a/legacy/elm_code/src/lib/elm_code_line.h +++ b/legacy/elm_code/src/lib/elm_code_line.h @@ -34,6 +34,8 @@ typedef struct _Elm_Code_Line void *data; } Elm_Code_Line; +EAPI void elm_code_line_free(Elm_Code_Line *line); + EAPI unsigned int elm_code_line_utf8_length_get(Elm_Code_Line *line); /**