Huw Davies : riched20: Pass a paragraph ptr to the paragraph destruction function.
Alexandre Julliard
julliard at winehq.org
Mon Oct 19 15:54:06 CDT 2020
Module: wine
Branch: master
Commit: 00824a032f1e2393793798a26482962787fb9ea6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=00824a032f1e2393793798a26482962787fb9ea6
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Oct 19 12:21:16 2020 +0100
riched20: Pass a paragraph ptr to the paragraph destruction function.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/editor.c | 5 +++--
dlls/riched20/editor.h | 2 +-
dlls/riched20/para.c | 20 +++++++++-----------
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index e512f2f9ed6..e988eb9a014 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3213,10 +3213,11 @@ void ME_DestroyEditor(ME_TextEditor *editor)
ME_ClearTempStyle(editor);
ME_EmptyUndoStack(editor);
editor->pBuffer->pFirst = NULL;
- while(p) {
+ while(p)
+ {
pNext = p->next;
if (p->type == diParagraph)
- destroy_para(editor, p);
+ para_destroy( editor, &p->member.para );
else
ME_DestroyDisplayItem(p);
p = pNext;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index ad7978c1f9d..4412a574262 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -75,7 +75,6 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
-void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN;
/* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
@@ -205,6 +204,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPE
void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
+void para_destroy( ME_TextEditor *editor, ME_Paragraph *item ) DECLSPEC_HIDDEN;
ME_Run *para_end_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt ) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index 41debcac1bd..0e1ceae9bbb 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -39,20 +39,18 @@ static ME_Paragraph *para_create( ME_TextEditor *editor )
return &item->member.para;
}
-void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
+void para_destroy( ME_TextEditor *editor, ME_Paragraph *para )
{
- assert(item->type == diParagraph);
-
- if (item->member.para.nWidth == editor->nTotalWidth)
+ if (para->nWidth == editor->nTotalWidth)
{
- item->member.para.nWidth = 0;
+ para->nWidth = 0;
editor->nTotalWidth = get_total_width(editor);
}
- editor->total_rows -= item->member.para.nRows;
- ME_DestroyString(item->member.para.text);
- para_num_clear( &item->member.para.para_num );
- para_mark_remove( editor, &item->member.para );
- ME_DestroyDisplayItem(item);
+ editor->total_rows -= para->nRows;
+ ME_DestroyString( para->text );
+ para_num_clear( ¶->para_num );
+ para_mark_remove( editor, para );
+ ME_DestroyDisplayItem( para_get_di( para ) );
}
/* Note para_next/prev will return the start and end doc nodes */
@@ -762,7 +760,7 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
para->next_para = next->next_para;
next->next_para->member.para.prev_para = para_get_di( para );
ME_Remove( para_get_di(next) );
- destroy_para( editor, para_get_di( next ) );
+ para_destroy( editor, next );
ME_PropagateCharOffset( para->next_para, -end_len );
More information about the wine-cvs
mailing list