Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-10-04 09:59:14 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-10-04 10:00:59 +0300
commit61218546cb79dbae09a6102a5695878ea96d0045 (patch)
treea20b94422893d9547a0ad8bd5776d4a9289ccfe9 /source/blender/editors/space_text
parent5884a0d66e808631b82dd8c467b01f99d41e27cb (diff)
Clenup: Text Editor: Fix inconsistencies in textline handling (makes coverty happy).
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_ops.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 060bf241bcf..948293d150b 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1062,16 +1062,17 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
for (tmp = text->lines.first; tmp; tmp = tmp->next) {
char *new_line;
+ BLI_assert(tmp->line);
+
flatten_string(st, &fs, tmp->line);
new_line = BLI_strdup(fs.buf);
flatten_string_free(&fs);
- /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
- if (tmp->line)
- MEM_freeN(tmp->line);
+ MEM_freeN(tmp->line);
if (tmp->format)
MEM_freeN(tmp->format);
+ /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
tmp->line = new_line;
tmp->len = strlen(new_line);
tmp->format = NULL;
@@ -1089,6 +1090,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
char *tmp_line_cur = tmp_line;
const size_t tab_len = st->tabnumber;
+ BLI_assert(text_check_line);
+
for (a = 0; a < text_check_line_len;) {
/* A tab can only start at a position multiple of tab_len... */
if (!(a % tab_len) && (text_check_line[a] == ' ')) {
@@ -1135,12 +1138,11 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
flatten_string_free(&fs);
#endif
- /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
- if (tmp->line)
- MEM_freeN(tmp->line);
+ MEM_freeN(tmp->line);
if (tmp->format)
MEM_freeN(tmp->format);
+ /* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
tmp->line = BLI_strdup(tmp_line);
tmp->len = strlen(tmp_line);
tmp->format = NULL;